Pro Tip: On Sending Email From Azure Virtual Machines to External Domains
When getting started with Azure, it’s natural to want to see if you can do all the things you can do on-premises in Azure. What better way to learn something new than by connecting it to things you already understand? Works for me, and I’ve seen it work for lots of other people as they ramp up on Azure.
One of the things that many IT Pros do on-premises is run mail servers and they’ve been doing it for many years. Running email is relatively complex, so the thought is “if I can get an email server running in Azure IaaS, then I probably can do just about anything else I can do on-premises”.
The good news is that you can run a mail server in Azure. However, you can’t run it exactly the same as you would run it on-premises. One of the key issues here relates to the ephemeral nature of Azure public IP addresses and potential for abuse and the effects that might have on other customers if they inherit your public IP addresses in the future. Because of this, we do *not* allow you to send email to external domains from Azure (this includes email servers and applications that send email as part of the service they provide).
To solve this problem, you’ll need to use an SMTP relay that is *not* hosted in Azure. That SMTP relay can be on-premises or you can use an SMTP hoster. Whatever works best for you.
There are some other things you need to understand about sending email from virtual machines to external domains and you can get those details in the blog post Sending E-mail from Azure Compute Resources to External Domains.