Did the message sending speed for this client exceed the set limit?

I have a for loop that calls some code sending emails. I get the following runtime error:

Service unavailable, closing transmission channel. The server response was: 4.4.2. The message rate for this client has exceeded the set limit.

After the googling around it seems to be associated with the "set-receiveconnector" possible for the exchange server? Can anyone advise how I can fix this?

code:

var mail = new MailMessage(); var smtpServer = new SmtpClient(SMTPServer); mail.From = new MailAddress(fromAddress); mail.To.Add(toAddress); mail.Subject = title; mail.IsBodyHtml = isHTML; mail.Body = message; if(attach != null) mail.Attachments.Add(attach); smtpServer.Port = xxx smtpServer.UseDefaultCredentials = false; smtpServer.Credentials = new NetworkCredential(SMTPUser, SMTPPassword); smtpServer.EnableSsl = true; smtpServer.Send(mail); //Error occurs here 
+4
source share
2 answers

Instead of sending emails directly, can you use a pickup folder?

 SmtpMail.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; 

in this way, you simply upload messages to a folder and let the exchange send them when they are ready, so if your user can only send, say, 3 per minute, the exchange should send 3, then send 3 more to the next pass, and so on.

+1
source

I solved this problem on my system using the correct port. The exchange method meant that SSL = TRUE, Port = 587 produced this error. If I changed it to use port 25, then everything worked fine. Therefore, contact your system administrators, this can help!

0
source

Source: https://habr.com/ru/post/1393359/


All Articles