Mails with PHP

Adedayo Emmanuel Olatayo 20 Reputation points
2023-09-22T16:30:01.14+00:00

Hi, I have a PHP application hosted on a VM in Azure that's supposed to send mails using PHPMailer but the mails are being blocked from sending. I've just discovered that Microsoft automatically blocks mails on port 25. Is there an alternative and also a documentation to implement. Also can I use Office 365 for the mails.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,785 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,162 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,358 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 107.9K Reputation points MVP
    2023-09-22T21:58:21.5233333+00:00

    Hi @Adedayo Emmanuel Olatayo ,

    one option is to use an authenticated SMTP relay service like Sendgrid.

    Recommended method of sending email


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Dillon Silzer 57,231 Reputation points
    2023-09-23T18:38:00.6633333+00:00

    Hello,

    To add here, you can set up XOUATH2 with PHPMailer. Here is a guide:

    Microsoft Azure and XOAUTH2 setup guide

    https://github.com/PHPMailer/PHPMailer/wiki/Microsoft-Azure-and-XOAUTH2-setup-guide

    0 comments No comments

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.