Vincent
Vincent

Reputation: 1

SMTP Emails Sending out Intermittently from application

I'm facing kind of SMTP mail problem sending through the application using coding as below

SmtpClient SMTPServer = new SmtpClient("smtp.office365.com"); SMTPServer.UseDefaultCredentials = false; SMTPServer.Credentials = new System.Net.NetworkCredential("[email protected]","xxxxx") SMTPServer.Port = 587; SMTPServer.EnableSsl = true;

So been using this method 2 years ago until recently where we face email not able to send out intermittently with error message "Smtp Error: Failure sending mail". There are times where emails could send out with only average 12 emails per day. Plus, the sender email address from the application is active with correct credential login and password.

I checked our Windows 2008 R2 server and tested with our disabled firewall on server. Problem still persists. And there were no patches update to the server as well.

Is there anything to do with authentication type level? Or certain communication protocol conflicts? How do I check further to determine the root of cause? Our firewall already allowed the port 587 to send out.

Upvotes: 0

Views: 559

Answers (1)

Rob Mascaro
Rob Mascaro

Reputation: 851

There could be many issues to check. You say that the application is sending emails as a "client" to an Exchange 365 SMTP server to sent onwards, that's what the example looks like.

  1. Check that Exchange is not rejecting the request. Microsoft can be very picky about application clients connecting directly. Look in the logs.

  2. Check that your email application client uses TLS 1.2 or above. Many SMTP servers will reject requests below that level.

  3. Exchange might be insisting on a STARTTLS for negotiation on credentials, so check if that is the issue.

  4. Check that the application client is whitelisted in MS Exchange 365 if it is rejecting requests.

  5. Check that the user you are connecting as has privilege to accept connections from remote clients. I often lock this down to prevent brute force password attacks.

Normally I would test all this out on the command line first. Get an email client for your OS like:

sendemail-1.56 by Brandon Zehm <[email protected]>

Which is very good at initiating a connection to a remote server. Test from your application client email server and see what happens.

Upvotes: 0

Related Questions