System.Web.Mail...

  • Thread starter Thread starter Pai
  • Start date Start date
P

Pai

Hello there,

I have an .aspx page in which I have a TextBox control in the which I
have the following text

string mystring = "<B>this is testing bold</B>"+"\r"+"This is testing
of carriage return";
TextBody.Text = mystring;

now I have the following code which sends the email:

MyMail.To ="(e-mail address removed)";
MyMail.From = "(e-mail address removed)";
MyMail.Subject = "Hello Testing Format";
MyMail.BodyEncoding = Encoding.UTF8;
MyMail.BodyFormat = MailFormat.Html;
MyMail.Body = TextMessage.Text;

SmtpMail.SmtpServer = "";
SmtpMail.Send(MyMail);

In the TextBox the text "This is testing of carriage return" appears
on the second line but in the email it appears on the same line.....

any help or sugggestions?

Kind Regards,
Srikanth Pai
 
Since you are using HTML you must use the <BR> tag instead of \r. Also when
it comes to text e-mail you should always use \r\n when breaking lines no
just \n.


string mystring = "<B>this is testing bold</B>"+"<BR>\r\n"+"This is testing


For a free SMTP assembly see the below URL:
http://www.freesmtp.net
 
Back
Top