|
如何寄發html格式的EMail? |
|
|
使用System.Net.Mail.MailMessage而不是System.Web.Mail.MailMessage MailMessage using System.Net; using System.Net.Mail;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.From = new MailAddress("toby@infolight.com"); message.To.Add(new MailAddress("toby@infolight.com.tw")); message.Subject = "Test"; message.Body = "Toby Test123"; message.IsBodyHtml = true;//設置成html格式
SmtpClient Client = new SmtpClient("infolight.com", 25); Client.EnableSsl = false; Client.UseDefaultCredentials = false; Client.Credentials = new NetworkCredential("toby", "toby"); Client.Send(message);
|
|
|