Hi Tan See Youu 陈诗右 !
Thank you for posting on Microsoft Learn.
You're running into a known Azure policy: Outbound port 25 (SMTP) is blocked by default on most Azure subscription types, including:
- Sponsorship
- Free Trial
- Pay-As-You-Go
- Azure for Students
This is intentional to prevent spam and abuse. Unfortunately, Azure will not unblock port 25 for these types of subscriptions, even upon request.
Instead of sending mail directly on port 25, configure your application to use an SMTP relay service that supports authentication on other ports:
- Microsoft 365 (Outlook): smtp.office365.com (port 587)
- SendGrid (has a free Azure plan): smtp.sendgrid.net (port 587)
- Mailgun, SMTP2GO, Amazon SES, etc.
These services require authentication and typically support port 587 (TLS) or 465 (SSL).
Example: SendGrid with Azure
- Sign up for SendGrid via Azure Marketplace
- Configure SMTP with:
Host: smtp.sendgrid.net Username: apikey Password: <your-api-key>
Azure only considers port 25 unblocking requests for Enterprise or MSDN (Visual Studio) subscriptions, and only in specific cases with strong justification. This is not available for Azure Sponsorship.