Azure – Sending emails with SMTP Relay on Office 365 via Azure VM

azureoffice365smtp

I am trying to resolve the issues around Azure and sending emails via Office 365 SMTP Relay (Connector), but the help online doesn't resolve the problem.

I have a PowerShell System setup on Azure which does automatic tasks. The system now sends emails afterwards in case of success or errors. Currently we are using our old mail provider which works fine. I update the send-mailmessage(even with the new Mailozaurr module) information to our SMTP Relay and works without issues from my local PC.

Now deploying the script on the AZURE VM it doesn't work. The "firewall" – Wherever I can manage that on Azure – seems to block port 25. None of the other standard ports work. Considered moving the VM to our AWS instance, as they don't seem to tell the Admin what they can and cannot do on their own VM.

How do I get my VM to send Emails via port 25 without further costs involved.

Best Answer

Outbound SMTP traffic on port 25 is blocked as documented here. You should be using authenticated SMTP on port 587 or 443.