Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 12, 2012 07:15 PM by ignatandrei
Member
491 Points
446 Posts
Feb 11, 2012 06:30 PM|LINK
Hi ,
How i can set HTML page to my required words to send mail via smtp.
means to enter user name the same page in email should be sent with the spcific username etc
Thanks
All-Star
135047 Points
21654 Posts
Moderator
MVP
Feb 11, 2012 08:22 PM|LINK
You can not from HTML page. You must write some custom code on server- there is where SMTP components are.
So you have 2 options:
1. WebForms - make your page an .aspx, use WebForms controls and send email
2. MVC - put on each HTML control a name and send form data to an action
Both cases , you should learn either from
http://www.asp.net/web-forms
or
http://www.asp.net/mvc
Feb 12, 2012 08:08 AM|LINK
ignatandrei You can not from HTML page. You must write some custom code on server- there is where SMTP components are.
Sorry i didnt write my post title well.
actually i wanted html page templates which should be used in smtp to send mail in asp.net
suppose i have created a html page with some pictures and paragraph . and i want to change the some text of that template :
For example :
Dear[Username]...
....
here in the html page username should be changed to required field
and that page should be sent via smtp in asp.net
Feb 12, 2012 03:12 PM|LINK
shan000 Dear[Username]
Read the template as string with File.ReadAllText
Replace in the string [UserName] with real name
Feb 12, 2012 05:53 PM|LINK
ignatandrei Read the template as string with File.ReadAllText Replace in the string [UserName] with real name
Thanks , i tried this but still its not changing , sending mail without change :
following is the code , please have a look :
HTML code part:
<tr> <td class="auto-style1">Dear <%userName%></td> </tr>
and c# code :
string body = File.ReadAllText(Server.MapPath("~\\user\\templates\\userReply.html")); body.Replace("<%userName%>", ViewState["username"].ToString());
Feb 12, 2012 07:15 PM|LINK
body= body.Replace(
shan000
Member
491 Points
446 Posts
How to send email through smtp using HTML template
Feb 11, 2012 06:30 PM|LINK
Hi ,
How i can set HTML page to my required words to send mail via smtp.
means to enter user name the same page in email should be sent with the spcific username etc
Thanks
Please Visit : www.classifiedspak.com
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: How to send email through smtp using HTML template
Feb 11, 2012 08:22 PM|LINK
You can not from HTML page. You must write some custom code on server- there is where SMTP components are.
So you have 2 options:
1. WebForms - make your page an .aspx, use WebForms controls and send email
2. MVC - put on each HTML control a name and send form data to an action
Both cases , you should learn either from
http://www.asp.net/web-forms
or
http://www.asp.net/mvc
shan000
Member
491 Points
446 Posts
Re: How to send email through smtp using HTML template
Feb 12, 2012 08:08 AM|LINK
Sorry i didnt write my post title well.
actually i wanted html page templates which should be used in smtp to send mail in asp.net
suppose i have created a html page with some pictures and paragraph . and i want to change the some text of that template :
For example :
Dear[Username]...
....
here in the html page username should be changed to required field
and that page should be sent via smtp in asp.net
Thanks
Please Visit : www.classifiedspak.com
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: How to send email through smtp using HTML template
Feb 12, 2012 03:12 PM|LINK
Read the template as string with File.ReadAllText
Replace in the string [UserName] with real name
shan000
Member
491 Points
446 Posts
Re: How to send email through smtp using HTML template
Feb 12, 2012 05:53 PM|LINK
Thanks , i tried this but still its not changing , sending mail without change :
following is the code , please have a look :
HTML code part:
and c# code :Please Visit : www.classifiedspak.com
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: How to send email through smtp using HTML template
Feb 12, 2012 07:15 PM|LINK