16 March 2016

Email sending in Azure Virtual Machine stopped working

In these days I came across with an old problem in a customer, all my processes stopped sending e-mails. In the past I already had this problem when I was on vacations but before my return all starts to work and because of this I never investigated that problem, so I thought “tonight is the night”.

I began to investigate the problem executing a query in the msdb DataBase that allowed me to see the logging of all emails that I was trying to send:

select *

from sysmail_event_log

order by 1 desc

And the error output was:

“The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 8 (2015-12-20T23:14:43). Exception Message: Cannot send mails to mail server. (Failure sending mail.).)”

Next step: validate the SMTP Server…

To do that you have to go IIS6

Then, go to properties in SMTP Server

Doing that I noticed that in the tab Access, option “Connection” I was blocking all the IP Adresses with an exception of my virtual machine IP.

It appears all right but I decided to try the selection “All except the list below” and retry to send a new test email. After doing that I was able to send emails again.

Cause of this issue:

My machine is an Azure Virtual Machine that doesn't have a dynamic internal IP. When I did a restart to the machine the IP was changed and because of that this machine was not allowed to access the SMTP Server.

Solution 1: Keep the option that all computers can access to this SMTP server

Solution 2: Change the VM to use a static internal IP Adress and put again the option “Only the list below”

Solution 3: Select “Only the list below” but using a domain instead of the IP

.

.

.

.

      André Marques
            Manager
Business Development
Blog