How to Set Up SMTP Relay in Azure
Published November 3, 2024 · Updated July 16, 2026 · SMTP & Deliverability
Trying to send email from an Azure virtual machine and hitting silence? You have met one of Azure's best-known quirks: Microsoft blocks outbound port 25 on most subscriptions to fight spam. That means you cannot send mail directly from an Azure VM — you must route it through an authenticated SMTP relay. Here is how to set up SMTP relay in Azure the right way.
Why direct sending fails on Azure
To protect its IP reputation, Azure blocks port 25 outbound for most accounts. Direct SMTP delivery from a VM simply times out. The supported path is to send through a relay on an authenticated port (587) — either Azure's own communication service or a third-party dedicated SMTP.
How to set up the relay
- Pick your relay: Azure Communication Services Email, or a third-party dedicated SMTP.
- Use port 587 with STARTTLS — not the blocked port 25.
- Authenticate with the relay's credentials (username and password or connection string).
- Add SPF, DKIM, and DMARC for your sending domain so mail is trusted.
- Point your app or VM at the relay host and send a test.
A dedicated SMTP relay for your Azure apps
Send from any Azure VM on port 587 with a dedicated IP and automatic authentication — unlimited volume, reliable inbox placement. From $39.99/mo.
Frequently asked questions
Why can't I send email from an Azure VM?
Azure blocks outbound port 25 on most subscriptions to prevent spam. Send through an authenticated relay on port 587 instead of direct SMTP.
What port should I use for SMTP on Azure?
Port 587 with STARTTLS, through an authenticated relay. Port 25 is blocked and port 465 may also be restricted depending on your setup.
Can I use a third-party SMTP relay on Azure?
Yes — a dedicated SMTP relay on port 587 works from any Azure VM, gives you a dedicated IP, and handles authentication for reliable delivery.