1

Since a few days, my application fails sending SMTP email. The app is in fact a scheduled task (which is running on my local machine, written in C#, using SmtpClient) and occasionally needs to send one (or a few) emails. The code is similar to this:

        var smtpClient = new SmtpClient();
        var mailMessage = new MailMessage(
            from, // account in my domain
            to,
            subject, body)
        {
            IsBodyHtml = true
        };
        smtpClient.Send(mailMessage);

Here's the relevant configuration section from my app.config file:

<system.net>
  <mailSettings>
    <smtp deliveryMethod="Network">
        <network enableSsl="true" 
               port="587" 
               userName="validuser@example.com" 
               password="********" 
               host="smtp.office365.com">
        </network>
    </smtp>
  </mailSettings>
</system.net>

Note that

  • This has worked for over a month
  • Nothing in the code has changed
  • I'm the only administrator of the Office 365 subscription, and haven't touched anything (I haven't even logged into the admin page) in the last month or so
  • I can still log in into Office 365 using the credentials in the config file
  • Suddenly, since a few days, I now get an SMTP error: "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated"

What could be causing this issue? Is there any logging or other diagnostics I could turn on to find out more information?

jeroenh
  • 111
  • 4
  • 2
    There were some updates to O365 in February in regards to Exchange Online (http://blogs.office.com/2014/02/13/exchange-online-protection-enhancements-part-1/) but they shouldn't have affected you here. You can check the message trace in O365. The details though aren't that helpful. Might be easiest to just call them or open a ticket online. Calling them for these issues I usually get through within 10 minutes. – TheCleaner Mar 10 '14 at 13:22
  • I just had this come up at a client who is using O365 and has a web app that was working fine with the same settings you have. Suddenly today it stopped working. Will be watching this page for updates and will let you know if I find a resolution. – pat o. Mar 10 '14 at 17:34
  • @Patrick I opened a ticket. One of the first suggestions was to try with a different user, so I tried with my own credentials and lo and behold, this worked. But hold your horses: the original ("technical") account that is supposed to send the mails still receives the same error, also after changing it's password. I also tried with a fresh account, which also doesn't get through. Very strange behavior, I have no idea why. I'll keep updating here with new info. – jeroenh Mar 11 '14 at 09:17
  • @jeroenh Interestingly enough, I tested it last night and everything was working for us, so it must have been a temporary thing, at least in our case. I did submit a ticket as well but the response seemed like a form letter asking for a bunch of information that wasn't relevant. Either way, I'm working now. Good luck! – pat o. Mar 11 '14 at 13:13
  • Didn't get exactly the same message as you, but make sure you dispose of the SMTP client *and* message. I'm sure you just missed that code out in your snippet, but thought I'd say just in case. The server may not like having multiple concurrent connections from you, which it might have if you hadn't disposed of the client. – Jack Hughes Mar 13 '14 at 16:33
  • This issue just cropped up for my client again. I just put in another service request with Microsoft. – pat o. Apr 16 '14 at 15:43
  • Clearly there must be an underlying issue. In my case, the issue also "went away". The answer to my support ticket was that they don't support "3rd party" software... :-( – jeroenh Apr 17 '14 at 13:06

0 Answers0