服务器响应为:5.7.0在System.Net.Mail.SmtpTransport的时间范围太短的消息太多

时间:2017-02-21 12:54:41

标签: c# smtpclient

我正在开发一个发送批量邮件的Windows应用程序 它成功地用于100封邮件。之后它开始显示 这些错误

  

服务器响应为:5.7.0在时间框架太短的情况下,消息过多   System.Net.Mail.SmtpTransport.SendMail(
  邮件地址发件人,
  MailAddressCollection收件人,
  字符串传递通知,
  布尔值allowUnicode,
  SmtpFailedRecipientException&安培;除外)
     在System.Net.Mail.SmtpClient.Send(MailMessage消息)
     在SmsAndEmail.Email.EmailIndex.SendTheMail()

这是我的代码:

MailMessage msg = new MailMessage();
msg.From = new MailAddress("MailAddress");
msg.To.Add(mail.ToAddress);
msg.Subject = "MySub";
msg.Body = mail.EmailBody;
SmtpClient client = new SmtpClient();
client.UseDefaultCredentials = true;
client.Host = "hostname";
client.Port = 587;
client.EnableSsl = false;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = new NetworkCredential("MailAddress", "password");
client.Timeout = 20000;
ServicePointManager.ServerCertificateValidationCallback =
  delegate(
    object s, 
    X509Certificate certificate,
    X509Chain chain, 
    SslPolicyErrors sslPolicyErrors
  )
  { return true; }
;
try
{
    client.Send(msg);
    newStatus = "SUCCESS";
}
catch (Exception ex)
{
    newStatus = "Failed";
    errorMessage = "Mail Sending Failed !";
    return errorMessage;
}

0 个答案:

没有答案