zimcoder Level: VB Lord

 Registered: 27-10-2003 Posts: 225
|
Re: how to mail html page
You have to specify the mail format in your mail body
check out this simple method that sends mail
public void SendMail()
{
MailMessage mail = new MailMessage();
mail.To = Email.Text.Trim();
mail.Cc = ConfigurationSettings.AppSettings["CarbonCopy"];
mail.From =ConfigurationSettings.AppSettings["Sender"];
mail.Subject = " Thank you for registering";
mail.BodyFormat = MailFormat.Html;
mail.Body = " Thank you "+Name.Text+" for registering please take note of the following details \n"+
"Username = "+Email.Text+"\n"+" Password = "+Password.Text;
MyError.ForeColor = Color.Green;
try
{
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["MailServer"];
SmtpMail.Send(mail);
MyError.Text ="Thank you for registering. A confimation email has been sent to you!";
pnlRegister.Visible = false;
LinkButton1.Visible = true;
}
catch (Exception ex)
{
MyError.Text="Sorry your message was not sent because an Error occured: Please verify that your email address is correct";
}
} |
construct the message as a normal html page
____________________________
BrainBench ADO.NET and ASP.NET Certified Developer
 
|