MailMessage myemailmessage = new MailMessage();
myemailmessage.From = "blue_89@163.com";
myemailmessage.To = "fenghu_89@126.com";
myemailmessage.Subject = "荷兰咯";
myemailmessage.Body = "aaaaaa";
myemailmessage.BodyFormat = MailFormat.Text;
myemailmessage.Priority = MailPriority.High;
//设置为需要用户验证
myemailmessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名(把emailaddress改为你的验证用户名)
myemailmessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "blue_89");
//设置验证密码(把password改为你的验证密码)
myemailmessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "198689198689");
myemailmessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/languagecode","0x0804");
myemailmessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2");
SmtpMail.SmtpServer = "smtp.163.com";
try
{
SmtpMail.Send(myemailmessage);
Response.Write("success");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}