Hi Bourne
Unfortunately I feel that the issue is not with the web client.
The web client is a custom .net web application that is using SmtpClient.Send as per the following code extract:
public static void SendText(string subject, string body, string to, string from)
{
if (string.IsNullOrWhiteSpace(to)) return;
try
{
var smtp = new SmtpClient(Properties.Settings.Default.EmailHost, Properties.Settings.Default.EmailPort);
smtp.EnableSsl = true;
smtp.Credentials = new NetworkCredential(Properties.Settings.Default.EmailUser, Properties.Settings.Default.EmailPassword);
var msg = new MailMessage(from, to, subject, body);
msg.IsBodyHtml = false;
smtp.Send(msg);
}
catch (Exception ex)
{
throw new Exception("Unable to send email to "+(to ?? "(null)"), ex);
}
}
The web application can successfully send emails for the majority of SMTP send requests and therefore there is no issue with the client application i.e. the problem is intermittent but seems an Exchange Online issue that related to concurrency. The exception returned indicates that Office 365 is closing the connection i.e. that the issue resides with Office 365. In any batch of send requests around 60% are being successfully sent.
It would be great to be able to get some diagnostics from Exchange online to understand what is causing it to close the connection.