SmtpException - operation completed

Here is my code:

SmtpClient client = new SmtpClient(); client.UseDefaultCredentials = true; using (client as IDisposable) { foreach (MailAddress addr in Addresses) { if (addr != null) { try { message.To.Clear(); message.To.Add(addr); client.Send(message); } catch (Exception ex) { Log(ex); } i++; } } } 

every 100 seconds, I log a message stating that

The operation is completed.

Is this setting on the client side or on the actual mail server?

+4
source share
1 answer

The problem occurs when you cannot connect to the SMTP server and therefore this timeout message occurs. Thus, this message appears on your client when your client cannot connect to your SMTP server:

100 seconds is the default value as described below: http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.timeout.aspx

There may be several problems this problem may occur with: an incorrect SMTP address, rejected SMTP, port settings, SSL settings, etc., which need to be fixed.

+4
source

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


All Articles