Home > Software design >  Connection refused to outlook.company.com mail server through php
Connection refused to outlook.company.com mail server through php

Time:10-08

Question, i am using symfony mailer for 6.1 (https://symfony.com/doc/current/mailer.html) and i seem to be getting a connection refused when trying to send an email to the server. Normally, i would assume username / password but i'm 99% sure it's sending the correct credentials to the server. When i dump the contents of the mailer object i can see the -username -password objects which match to what they should be.

Using the following settings, port 587, smtp, outlook.company_name.com, Authmode login (Tried with and without in the DSN string), I Tried enabling TLS and disabling it on the same port 587. I Was wondering if anyone has some good example(S) on getting this to work properly? I have verified the username / password as it lets me in via the web gui, but i have a feeling it's something special i'm probably doing with either the DSN string or some other setting/incorrect port maybe. I'm also not sure what the correct way to debug this would be if anyone has any tips.

CodePudding user response:

If your Outlook service is hosted by Microsoft, it's very likely that you're seeing their policy change that no longer allows SMTP authentication using ID and password.

You need to implement XOAUTH2 support, which although technically supported by PHPMailer (which you're not actually using as it's not the same thing as Symphony mailer), is proving very difficult to get working in practice.

CodePudding user response:

@rob Take a look at my new wiki article and see if this helps you set it up

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

  • Related