Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending via Office365 SMTP failed. Password command failed #1339

Closed
akephalos opened this issue Jan 24, 2018 · 6 comments
Closed

Sending via Office365 SMTP failed. Password command failed #1339

akephalos opened this issue Jan 24, 2018 · 6 comments

Comments

@akephalos
Copy link

akephalos commented Jan 24, 2018

Hi, I'm trying to set up a PHP-Script which is working with PHP-Mailer to send Mails from an internal server to our customer.

require_once('/scripts/PHPMailer-master/PHPMailerAutoload.php');    
$mail = new PHPMailer();   
$mail->CharSet = 'UTF-8';   
$mail->isSMTP();   
$mail->SMTPDebug = 2;   
$mail->Host = "smtp.office365.com";   
$mail->Port = 587;   
$mail->SMTPSecure = 'tls';   
$mail->SMTPAuth = true;   
$mail->Username = mail@zfu.ch;   
$mail->Password = "password"; 

I already set up a connector on the Office 365 Exchange.
The extension=php_openssl.dll in php.ini is set up as well.
Credentials were checked multiple times and if I enter a wrong Password there is the same error message. I hope someone knows a possible solution for this Problem.

2018-01-24 07:08:16 SERVER -> CLIENT: 220 VI1PR08CA0095.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 24 Jan 2018 07:08:16 +0000 
2018-01-24 07:08:16 CLIENT -> SERVER: EHLO input 
2018-01-24 07:08:16 SERVER -> CLIENT: 250-VI1PR08CA0095.outlook.office365.com Hello [62.2.201.50] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 
2018-01-24 07:08:16 CLIENT -> SERVER: STARTTLS 
2018-01-24 07:08:16 SERVER -> CLIENT: 220 2.0.0 SMTP server ready 
2018-01-24 07:08:16 CLIENT -> SERVER: EHLO input 
2018-01-24 07:08:16 SERVER -> CLIENT: 250-VI1PR08CA0095.outlook.office365.com Hello [62.2.201.50] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH LOGIN XOAUTH2 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 
2018-01-24 07:08:16 CLIENT -> SERVER: AUTH LOGIN 
2018-01-24 07:08:16 SERVER -> CLIENT: 334 VXNlcm5hbWU6 
2018-01-24 07:08:16 CLIENT -> SERVER: xxx= 
2018-01-24 07:08:16 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 
2018-01-24 07:08:16 CLIENT -> SERVER: xxx= 
2018-01-24 07:08:22 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [VI1PR08CA0095.eurprd08.prod.outlook.com] 
2018-01-24 07:08:22 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [VI1PR08CA0095.eurprd08.prod.outlook.com] 
2018-01-24 07:08:22 SMTP Error: Could not authenticate. 
2018-01-24 07:08:22 CLIENT -> SERVER: QUIT 
2018-01-24 07:08:22 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel 
2018-01-24 07:08:22 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Thank you.

@Synchro
Copy link
Member

Synchro commented Jan 24, 2018

We've seen this before in #189, where it turned out to be inconsistent behaviour from Office365 - the same code and credentials worked at one point, not at another. I've seen mention elsewhere of needing to create app-specific passwords in office365. You could also try XOAUTH2 authentication, though it's more complex to set up.

I can also tell you're using an old version of PHPMailer - please upgrade.

@edenpark59
Copy link

edenpark59 commented Jan 24, 2018

$mail->Username = mail@zfu.ch;
Your mail adress is a string, so use " or ';
example : $mail->Username = 'mail@zfu.ch';

@bibz0r
Copy link

bibz0r commented May 25, 2018

We just had this problem (535 5.7.3 Authentication unsuccessful) on our hosted exchange.. Enabling GSSAPI on the Exchange server fixed it. :)

@billjave
Copy link

billjave commented Jul 4, 2018

Pls can someone chat me up private...i need to be having serious issue in getting php mailer...Can someone please help me with this, and i compensate for this...please... i need a good mailer php, that i can be sending mails to my clients...Please

@billjave
Copy link

billjave commented Jul 4, 2018

@bibz0r @edenpark59 Pls kindly be of help.... Admin, is it wrong to drop my icq or email here ..

@Synchro
Copy link
Member

Synchro commented Jul 4, 2018

@billjave Download the latest version, or ideally install it into your app using composer (as the readme says), write code to use it based on the examples and documentation, if you have trouble, read more docs, read questions on Stack Overflow, and if you still have trouble, ask specific questions and describe exactly what your problem is.

Don't demand private help for undefined problems by hijacking unrelated questions, hassling those that are also asking questions, it just annoys everyone. If you don't know how to write scripts, employ someone that does.

@Synchro Synchro closed this as completed Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants