Exchange 365 - sendmail php

Copper Contributor

I want to use a email group.
So i have used the sendmail.php file to have it send the mail trough a application website, into that mailbox.

But i have tried all known combo's that i know of, and the closest i get is the STARTTLS error.
My manager want to use XAMPP with this sendmail option.
But the more i try to look into this, the more 'outdated' hints i get.

sendmail.ini settings:

smtp_server=smtp.office365.com //Outlook settings

; smtp port (normally 25)

smtp_port=587

; SMTPS (SSL) support
; *auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL

smtp_ssl=auto
===========

if your smtp server requires authentication, modify the following two lines

auth_username=*full email*
auth_password=*password*
===========I even tried using POP3
pop3_server=outlook.office365.com
pop3_username=*full email*
pop3_password=*password*
===========ehlo/helo
hostname=smtp.office365.com

Can someone point me in a good direction,
because i also tried PHPmailer, but all i can find is outdated Google hints.

1 Reply

Hi Dennis,

 

Microsoft 365 now only supports modern authentication/OAuth. Microsoft has deprecated all legacy authentication protocols but made an exception for SMTP AUTH (587/TCP).

1. SMTP AUTH prerequisites
- A user with a mailbox (at least a Exchange Online P1 license)
- SMTP AUTH has to be enabled at the user- or tenantlevel
- Security defaults has to be turned off
- MFA has to be disabled in the per-user MFA portal
- The user has to be excluded from the conditional access policy that enforces MFA

2. SMTP AUTH settings
Please check this link:
https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-de...

3. Azure portal
Please check the sign-in logs in the Azure portal and look for the connection attempts (interrupted or failure).

https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/concept-sign-ins

4. Alternative 1: SMTP

You can still use 25/TCP (unauthenticated) when you create a connector in the EXO admin center and whitelist the public IP from where your emails originate. Also, don't forget to add the public IP to SPF-record for the public domain.

https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-de...

 

5. Alternative 2: SendGrid

SendGrid can be a valid alternative.