发邮件问题:“邮箱不可用。 服务器响应为:”
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 += "测试邮件发送失败! ";
&nb