How can I relay smtp from my azure exchange vm to my mx record *.mail.protection.outlook.com on port 25?

AM 20 Reputation points
2025-05-08T20:29:01.4833333+00:00

Anybody have any ideas, how can I smtp relay from my azure exchange vm to my mx record *.mail.protection.outlook.com on port 25?

I've tried adding nsg's and asg's to nsg's. I cant get port 25 to let me handshake. using smtp.office365.com requires authentication, but this is for an exchange hybrid relay server.

I've also noticed that *.mail.protection.outlook.com:587 also doesnt work (which i think the documentation alludes to but doesnt specify).

thanks in advance,

-M

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,032 questions
{count} votes

Accepted answer
  1. Anusree Nashetty 4,470 Reputation points Microsoft External Staff Moderator
    2025-05-09T21:09:03.1533333+00:00

    Hi AM,

    Alternate workarounds: Use authenticated SMTP over alternate ports:

    Option 1: Use Microsoft 365 (Exchange Online)

    • SMTP server: smtp.office365.com
    • Port: 587
    • Encryption: STARTTLS
    • Requires authentication with a valid Microsoft 365 account

    Option 2: Use a third-party SMTP relay like SendGrid

    • Azure officially partners with SendGrid
    • Offers free and paid tiers
    • Uses port 587 or 465 with authentication

    Option 3: Set up a relay VM outside Azure

    • Host an SMTP relay (e.g., Postfix or Exim) on a VPS or dedicated host with port 25 open
    • Configure Azure VMs to relay mail through that external server using port 587 or 465.

    There are several cloud email services available to use. Some of the prominent names are SendGrid, MailJet, and MailGun(Highly reliable, scalable, and widely used for transactional emails and has a Foundation plan (~$35/month) supporting 50,000+ emails/month). Whichever email service you choose, using them to send emails from Azure is similar, server address and port for SMTP and API endpoint address for REST.

    SendGrid is probably the most popular email service option for sending emails from Azure. https://www.twilio.com/docs/sendgrid/for-developers/partners/microsoft-azure-2021

    You can upgrade to a Paid SendGrid Plan (Recommended for Azure-native workflows)

    • SendGrid offers Essentials, Pro, and Premier plans.
    • The Essentials plan starts at ~$14.95/month for up to 50,000 emails/month.
    • You can scale to millions of emails/month by moving to the Pro or Premier tiers.
    • These tiers also include:
    • Dedicated IPs (for better deliverability)
      • High throughput
      • API and SMTP relay support over port 587.

    Use Azure Communication Services (ACS) Email lhttps://learn.microsoft.com/en-us/azure/communication-services/overview

    This is Microsoft's native email service — scalable, reliable, and port 25–safe.

    Benefits:

    • Uses SMTP or REST API
    • Microsoft-managed infrastructure (excellent deliverability)
    • Can be integrated with Azure Functions, Logic Apps, VMs, etc.
    • Offers custom domain + DKIM/SPF support You can send a limited number of email messages. If you exceed the email rate limits for your subscription, your requests are rejected. You can attempt these requests again, after the Retry-After time passes. Take action before reaching the limit by requesting to raise your sending volume limits if needed. https://learn.microsoft.com/en-us/azure/communication-services/concepts/service-limits#email

    If you have any further queries, let me know. If the information is helpful, please click on Upvote and Accept Answer on it.

    User's image

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.