I have been using PHPMailer
to send SMTP email on behalf of my office365 account, and it was working for about a week. Then it suddenly quit working and I don't know what changed.
When I enable high debug logging in PHPMailer I see this:
SMTP -> FROM SERVER:220 CY4PR15CA0011.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 10 Jan 2019 13:30:20 +0000 SMTP -> FROM SERVER: 250-CY4PR15CA0011.outlook.office365.com Hello [198.154.243.158] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 SMTP -> ERROR: AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type [CY4PR15CA0011.namprd15.prod.outlook.com] SMTP -> FROM SERVER:250 2.0.0 Resetting
This piece seems to be the most relevant:
AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type
Here are my literal SMTP settings as being handed to PHPMailer:
smtpAuth: true
smtpSecure: STARTTLS
smtpHost: smtp.office365.com
smtpPort: 587
smtpUsername: [hidden]
smtpPassword: [hidden]
emailTo: [hidden]
And the actual PHP code:
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = $smtpAuth;
$mail->SMTPSecure = $smtpSecure;
$mail->Host = $smtpHost;
$mail->Port = $smtpPort;
$mail->Username = $smtpUsername;
$mail->Password = $smtpPassword;
$mail->SetFrom($smtpSenderDisplay);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($emailTo);
As as sanity check, I set up an SMTP account with these same settings in Windows Live Mail
- and everything works. No errors. Outgoing email lands in the inbox of a different email account I have.
So Windows Live Mail is doing something a little differently from what my PHP script is doing AND remember my PHP script was working fine up until a few days ago.
Any ideas what I need to change?
$mail->SMTPDebug = 1;
) to find out – Vinay$mail->SMTPDebug = 2
is the most detailed. – HerrimanCoder