Cannot send email (SMTP/Port 25)

Rohan Sirimalla 0 Reputation points
2025-06-13T08:30:34.2133333+00:00

Hi, I've been trying to set up an outgoing email server from the VM (tried Ubuntu 24.04 image and hMailServer) in Azure that should be able to send emails. Currently, I am unable to send outbound emails directly from this server to external mail servers because outbound traffic on port 25 is blocked. My use case involves sending legitimate transactional and business emails directly from my own SMTP server without relying on third-party relay services. This capability is critical for my operations.

I have verified that:

  • The SMTP service is properly configured and listening on port 25 on the VM.
  • Network Security Group (NSG) rules and Windows Firewall allow inbound and outbound traffic on port 25.
  • The issue is due to Azure’s platform-level block on outbound port 25.

I kindly request the removal of this outbound port 25 restriction for my subscription and VM so that I can send emails directly from my server.

Thank you for your assistance.

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

1 answer

Sort by: Most helpful
  1. Nikhil Duserla 7,935 Reputation points Microsoft External Staff Moderator
    2025-06-13T10:48:15.18+00:00

    Hello @Rohan Sirimalla,

    Azure blocks outbound SMTP connections on TCP port 25 for all deployed virtual machines by default. This is a security measure designed to protect Microsoft’s platform, align with industry standards, and safeguard both customers and partners.

    Since you're using a non-enterprise subscription, specifically a Student plan, this port restriction is expected behavior.

    However, for learning purposes, you can use an authenticated SMTP relay service, which typically communicates over TCP port 587. These services are designed to maintain good IP and domain reputation, reducing the chances that your messages are marked as spam or rejected by external domains. SendGrid is one example, though there are several other options available. These services are fully supported in Azure across all subscription types.

    For users with Enterprise Dev/Test subscriptions, it is possible to request the removal of the port 25 block. This can be done by navigating to the “Diagnose and Solve” blade within the Azure Virtual Network resource in the Azure Portal. Running the "Cannot send email (SMTP-Port 25)" diagnostic will automatically exempt qualified subscriptions. Once the exemption is granted, the affected VMs must be stopped and restarted for the change to take effect.

    Since you're using a student subscription, this exemption option is unfortunately not available. We recommend using an SMTP relay service as the best alternative in your case- https://learn.microsoft.com/en-us/azure/virtual-network/troubleshoot-outbound-smtp-connectivity?source=recommendations#enterprise-and-mca-e

    Please let us know what is still needed in the comments so the question can be answered.


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.