public class SMTPManager
{
public SMTPManager()
{
}
public static void SendEmail(string FROM, string FromDisplayName, string TO, string BODY, string SUBJECT, bool bIsHtml)
{
MailMessage m = new MailMessage();
m.From = new MailAddress(FROM, FromDisplayName);
m.To.Add(TO);
m.Subject = SUBJECT;
m.Body = BODY;
m.BodyEncoding = System.Text.Encoding.UTF8;
m.IsBodyHtml = bIsHtml;
//m.ReplyTo = new MailAddress(FROM);
//smtp.126.com不可用,所有使用smtp.gmail.com
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Credentials = new NetworkCredential("zfj123589", "123zxcvb");
smtp.EnableSsl = true;
smtp.Send(m);
}
}