How can I open port 25 to allow sending email from Azure VM

MFP Admin 0 Reputation points
2025-04-09T03:30:20.7733333+00:00

Hello,

Is it possible to open port 25, to enable an application running on an Azure VM to send email using the domain's MX record address as the SMTP server? I've had this setup running successfully on-premises, and have since moved the server into Azure.

Thank you!

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

1 answer

Sort by: Most helpful
  1. Mounika Reddy Anumandla 4,465 Reputation points Microsoft External Staff
    2025-04-09T04:05:22.5+00:00

    Hi MFP Admin,

    On-premises, sending email directly to recipient mail servers (using DNS MX lookups and port 25) is usually unrestricted. But once the server was moved into Azure, that behavior changed because Azure VMs can't send outbound traffic over port 25 by default, regardless of whether you're using a public MX record or a custom domain.

    The ability to send outbound emails via port 25 depends on your subscription type:

    • Enterprise Agreement (EA) and Microsoft Customer Agreement for Enterprise (MCA-E) Subscriptions: Outbound SMTP connections on port 25 are allowed by default. However, for Enterprise Dev/Test subscriptions, port 25 is blocked by default but can be unblocked upon request.
    • Other Subscription Types (like Pay-As-You-Go): Outbound traffic on port 25 is blocked by default, and this restriction cannot be lifted

    We recommend you use authenticated SMTP relay services to send email from Azure VMs or from Azure App Service. Connections to authenticated SMTP relay services are typically on TCP port 587 which is not blocked.

    Using these email delivery services on authenticated SMTP port 587 isn't restricted in Azure, regardless of the subscription type. https://learn.microsoft.com/en-us/azure/virtual-network/troubleshoot-outbound-smtp-connectivity

    similar references: https://learn.microsoft.com/en-us/answers/questions/1679480/virtual-machine-smtp-(25)-port-blocked-fix

    Hope this helps!

    Let me know if you have any further queries!

    Hope the information provided is helpful to you, I would request you to kindly please consider accepting it as an answer and do a thumbs up at “Was it helpful”. This in turn will benefit other community members with similar scenario navigate better to right solution.User's image

    0 comments No comments

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.