发邮件问题:“邮箱不可用。 服务器响应为:”
string strMessage = " ";
SmtpClient smtp = new SmtpClient( "smtp.126.com ");
MailAddress MailSender = new MailAddress( "dfx2057@126.com "), receiver = new MailAddress(dreams1981@126.com);
MailMessage mm = new MailMessage();
mm.Sender = MailSender;
mm.From = new MailAddress( "dfx2057@126.com ");
mm.To.Add(receiver);
smtp.Credentials = new System.Net.NetworkCredential( "dfx2057 ", "pp123456 ");
mm.IsBodyHtml = true;
mm.BodyEncoding = System.Text.Encoding.GetEncoding( "gb2312 ");
mm.Body = "邮件参数设置测试成功! ";
mm.SubjectEncoding = System.Text.Encoding.GetEncoding( "gb2312 ");
mm.Subject = "邮件参数设置测试! ";
HttpFileCollection files = HttpContext.Current.Request.Files;
try
{
smtp.Send(mm);
strMessage += "测试邮件已经发出,请到 " + "\ " " + email_receiver.Text.ToString().ToString() + "\ "检查是否收到邮件! ";
}
catch (SmtpFailedRecipientException ex)
{
strMessage += "测试邮件发送失败! ";
}
catch (SmtpException ex)
{
strMessage += "测试邮件发送失败! ";
}
catch (Exception EE)
{
strMessage += "测试邮件发送失败! ";
}
ClientScript.RegisterStartupScript(this.GetType(), "MAIL ", "alert( ' " + strMessage + " '); ", true);
----------------------------
错误提示就是:邮箱不可用。 服务器响应为:######(这里显示####乱码的)
在网上找到的答案是件服务器的问题,,但我换一个旧的126邮箱去发送。。那就没问题了。。就是新注册的126邮箱都发不了!
[解决办法]
帮顶