Sending Mail and Configuring Your Server for an ASP.NET 2.0 Email System - Sending HTML Format Email
(Page 2 of 4 )
Similarly, according to the earlier explanations, it will take steps 1-6 and step 8, or seven steps altogether, to send HTML formatted e-mails. Here for brevity, we mainly list the different steps:
protected void NewBtn_Click(object sender,EventArgs e)
{
///……omit steps 1-5 (same as the above section);
mailMsg.IsBodyHtml = HtmlCB.Checked;
nContain += mailMsg.Body.Length;
if(mailMsg.IsBodyHtml == true)
{nContain += 100; }
try
{ ///send email(s)
IMail mail = new Mail();
mail.SendMail(mailMsg);
///save them
int nMailID = mail.SaveAsMail(mailMsg.Subject,mailMsg.Body,from,
To.Text.Trim(),CC.Text.Trim(),mailMsg.IsBodyHtml,
nContain,mailMsg.Attachments.Count > 0 ? true : false);
}
catch(Exception ex)
{ ///……omitted}
Response.Redirect("~/MailDesktop.aspx");
}
Next: Sending Email with Attachments >>
More ASP.NET Articles
More By Xianzhong Zhu