Database mail in Azure VM with SQL Server installed on it We migrated 4 servers with SQL Server instances to Azure VM around 2-3 months ago. We configured "database mail" the same way we did for the on-prem servers. Mail worked fine immediately. All of a sudden, yesterday around 4 pm, mails were not able to be sent. 

Error is: The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2020-02-06T08:20:42). Exception Message: Could not connect to mail server. (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond :25).)

We have researched and all we find is that we should not use port 25, but when we change it to port 587 it failed as well. 

The settings we use to configure database mail account are:


Server name: .mail.protection.outlook.com 
Port: 25
SMTP Authentication: Anonymous.


By the way, the servers we still have on-premises are working fine using the exact same settings.

As a workaround, we have configured sendgrid to send mail for the azure servers, but my question is if someone can help us to configure the SQL Server database mail correctly in the azure vm using the office 365 exchange.

Thanks!
Check out this link - basically, you need to use an authenticated relay (like sendgrid) when sending from an Azure VM. 

There are some exceptions:


Enterprise Agreement subscriptions don't have this restriction
Pay-As-You-Go subscriptions can submit an exemption request and if approved you will not have to use an authenticated relay. Note, this only applies to VMs. PaaS services cannot be exempted.


All other subscriptions do not have the exemption option - you must use an authenticated relay.