How to configure email from Linux server to O365 with Non-Profit sponsorship

Eduard Martinescu 0 Reputation points
2025-05-07T15:44:18.2+00:00

So, I'm helping out a non-profit that has both Office 365 and Azure via a sponsorship. They run a WordPress server in Azure and want to be able to receive email from that server to some accounts in their O365 service.

I'm going through the various options available here https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365, but it seems to be impossible. The default security settings are enabled, so using option 1 is impossible. Both option 2 and 3 require port 25 not to be blocked, but I can not find any way to unblock port 25 on the Azure virtual machine (as the non-profit sponsorship does not appear to be an Enterprise agreement)

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-05-07T16:23:15.9+00:00

    You're absolutely right that for most Azure subscriptions (including sponsorships, free, and non-Enterprise ones), outbound port 25 is permanently blocked for VMs to prevent abuse, and there's no override unless you're under an Enterprise Agreement and explicitly request an exception (which isn't available to non-profits or small orgs typically).

    That effectively eliminates Option 2 (Direct Send) and Option 3 (SMTP Relay via MX endpoint) in Microsoft's guide.

    So you're left with Option 1: SMTP Client Submission (authenticated SMTP) — but as you noted, this is disabled by default for most tenants now due to security hardening (Basic Auth deprecation, etc.).

    As per my understanding, If you want a more robust, secure method you can use a 3rd-party transactional email service (SendGrid, Mailgun, etc.)https://sendgrid.com/en-us
    221156-image.png

    Additional ref: https://wpmailsmtp.com/twilio-sendgrid-review/
    https://wordpress.org/plugins/wp-mail-smtp/
    Hope it helps!

    Let me know if you have any further queries!

    If the information is helpful, please click "upvote" to let us know!

    1 person found this answer 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.