Link to home
Start Free TrialLog in
Avatar of srk1982
srk1982

asked on

Formatting the body while sending email using asp.net 1.1

Hi,

   I use the below code to send email using asp.net 1.1 and codebehind as c#.

here what i want is....In the email which is sent, the body shud be with a line break. like this :
__________________________________________
Hi
Risk  strRiskNo,
Insured strInsuredName
is sent for your review
Thanks
__________________________________________
currently i get the body like this...
Hi<br>Risk PQ2008000463,Insured HAVEis sent for your review<br>Thanks

There is no line break for the code which i have pasted below.
Please help on this..
Its urgent
Thanks..
MailMessage objEmail = new MailMessage();
			objEmail.To       = strEmailID;
			objEmail.From     = "admin.abc@sg.abc.com";
			objEmail.Subject  = "Quotation for Review";
			objEmail.BodyFormat = MailFormat.Html;
			objEmail.Body     = "Hi" + "<BR>" + "Risk " + strRiskNo + ",Insured " + strInsuredName + "is sent for your review" + "<br>" + "Thanks" ;
			objEmail.Priority = MailPriority.High;
			SmtpMail.SmtpServer = strSmtpServer; 
			try
			{  
				SmtpMail.Send(objEmail);
				lblmsg.Text = "Quotation has been sent for review" ;
			}
			catch (Exception exc)
			{
			  	throw exc;
			}

Open in new window

SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of srk1982
srk1982

ASKER

Hi Dhaest,

 I could not find any property like HTMLBody  for the object objEmail.

Thanks,
Actually I don't see any problem with your code  (see http://www.systemwebmail.com/faq/2.2.aspx). Are you sure that your email-receiver can handle html-messages (or turned in) and not only text ?
Avatar of srk1982

ASKER

Hi Dhaest,

 I tried with the same sample provided in the link, that u posted in the previous post.
I am not getting the line break.
There is shud be something missing or going wrong...
 
Please help...Thanks
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey this is a fantastic answer. It really helped me a lot.
To add on to this look at this link.

http://stackoverflow.com/questions/1660932/how-do-i-send-formatted-text-in-email-using-c