Cannot send email from php app inside azure vm

Alexandru Paraschiv 0 Reputation points
2025-01-13T21:22:28.1566667+00:00

I am using Laragon to run a php app on a virtual machine. This app needs to send an email to a specified email but it's not working from the vm. The exact same app is able to send the email when I'm running it from my computer but not from the vm. Please let me know if you need more details from my side.

Thank you!

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

1 answer

Sort by: Most helpful
  1. Silvia Wibowo 4,926 Reputation points Microsoft Employee
    2025-01-13T22:56:59.7233333+00:00

    Hi @Alexandru Paraschiv , I understand that you have an issue sending an email with app on Azure VM.

    The Azure platform blocks outbound SMTP connections on TCP port 25 for deployed VMs. This block is to ensure better security for Microsoft partners and customers, protect Microsoft's Azure platform, and conform to industry standards.

    We recommend you use authenticated SMTP relay services to send email from Azure VMs. Connections to authenticated SMTP relay services are typically on TCP port 587 which is not blocked. These services are used in part to maintain IP reputation which is critical for delivery reliability.

    More info: Troubleshoot outbound SMTP connectivity problems in Azure

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.


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.