SmtpClient smtp = new SmtpClient();
smtp.EnableSsl = false;
smtp.Host = "smtp.163.com";
smtp.Port = 25;
smtp.UseDefaultCredentials = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential("m15889713189@163.com", "19872146912");
MailMessage mailmessage = new MailMessage();
mailmessage.Priority = MailPriority.High;
mailmessage.Subject = "你的密码已找回";
mailmessage.Body = "你的密码是"+ strPwd+"请记好!";
mailmessage.IsBodyHtml = true;
mailmessage.BodyEncoding = System.Text.Encoding.GetEncoding(936);
mailmessage.From = new MailAddress("m15889713189@163.com", "新华书店", System.Text.Encoding.GetEncoding(936));
mailmessage.Sender = new MailAddress("m15889713189@163.com", "新华书店", System.Text.Encoding.GetEncoding(936));
mailmessage.To.Add(new MailAddress(strEmail, "用户" + strName, System.Text.Encoding.GetEncoding(936)));
try
{
smtp.Send(mailmessage);
}
catch (SmtpFailedRecipientException ex)
{
string message = ex.InnerException.Message;
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script>alert('" + message + "')</script>");
}
catch (SmtpException ex)
{
string message = ex.Message;
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script>alert('" + message + "')</script>");
}
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"sendsuccess","<script>alert('邮件发送成功')</script>");
是不是被当做垃圾邮件处理了?看看垃圾邮件站里面。
我去还真是,怎么会这样这个问题怎么解决
@星休: 据说是要套个壳子,你网上百度一下解决方案,看看你们的发送邮件代码块和别人的有什么区别。
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential("m15889713189@163.com", "19872146912");
MailMessage mailmessage = new MailMessage();
这个用户名和密码是怎么回事???
网易邮箱用户和密码
@星休:
直接贴上来不怕被人盗了吗?
@XiaoFaye: 一个邮箱而已没这么蛋疼吧