How do I send email from a VM. What ports can be used?

James Whitley 20 Reputation points
2024-06-17T20:52:10.3233333+00:00

I have a PHP app running on a VM but cannot email from it. Seems port 25 is blocked. What is the minimal services (Email Communication Service/SMTP) or alternate port that I can use to send a site registration email?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,991 questions
Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
895 questions
0 comments No comments
{count} votes

Accepted answer
  1. TP 97,996 Reputation points
    2024-06-17T23:59:23.8466667+00:00

    Hi James,

    One method to send emails from your app would be to use Azure Communication Services (ACS). Which port you need depends on the specific technique you use to send the messages.

    For example, you could use the REST api to send the messages to ACS, in which case you would use port 443. OR, you could use SMTP to send to ACS, and in that case you would use port 587.

    Below article shows you how to set things up to use SMTP (via secure port 587) to send emails to ACS:

    Quickstart: How to create authentication credentials for sending emails using SMTP

    https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/email/send-email-smtp/smtp-authentication

    Article below walks through using client SDKs, portal, CLI, which under the covers use REST API. Unfortunately I don't see php client:

    Quickstart: How to send an email using Azure Communication Services

    https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/email/send-email

    Below article documents REST API so that you can send email that way:

    Email - Send

    https://learn.microsoft.com/en-us/rest/api/communication/dataplane/email/send?view=rest-communication-dataplane-2023-03-31&tabs=HTTP

    In addition to the above you always could use one of the many third party services that allow you to send emails through them, such as Twilio SendGrid, SMTP2GO, etc.

    Please click Accept Answer and upvote if the above was helpful. If something is unclear and/or you have a specific question on how to send via one of the above methods, add a comment.

    Thanks.

    -TP

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most 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.