C# 邮件类 Mailmessage
MailMessage Mailmsg = new MailMessage();
Mailmsg.To = "wu922008@126.com";
Mailmsg.From = "wu922008@163.com";
Mailmsg.Subject = "测试";
Mailmsg.Body = "我 love you";
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名(邮箱的用户名)
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "wu922008@163.com");
//设置验证密码(邮箱的密码)
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "**********");
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send(Mailmsg);
Console.WriteLine("邮件发送完成!!");
Mailmsg.To = "wu922008@126.com";
Mailmsg.From = "wu922008@163.com";
Mailmsg.Subject = "测试";
Mailmsg.Body = "我 love you";
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名(邮箱的用户名)
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "wu922008@163.com");
//设置验证密码(邮箱的密码)
Mailmsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "**********");
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send(Mailmsg);
Console.WriteLine("邮件发送完成!!");
本文来自博客园,作者:至道中和,转载请注明原文链接:https://www.cnblogs.com/voidobject/archive/2012/04/14/3975504.html