-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Description
I hope I do not duplicate existing issues. I saw few similar problems, but I couldn't find working solution.
My code is working and I'm able to authenticate and send email through private and gSuite accounts successfully when scope for obtaining token is set to
$options = [ 'scope' => [ 'https://mail.google.com/' ] ];
Yet, I hope my app will be used not just by me, so I would like to limit scope to just sending emails. Changing it to:
$options = [ 'scope' => [ 'https://www.googleapis.com/auth/gmail.send' ] ];
still let me authorise app with gMail, but attempt to send email give me this:
2019-02-15 10:12:40 CLIENT -> SERVER: AUTH XOAUTH2 dXNlcj1rcnp5c3p0b2Yua3ViaWtAZ21haWwuY29tAWF1dGg9QmVhcmVyIHlhMjkuR2x1eEJxZGkzalF4MkVJaGdWMjZ4MWxvbEc3aUdoSTN4MjFSdEFXSzV2QmhTX0FkR0RodmlnSTEtSmd3dUIzTGU1QktaUUxkeTBSeno4UFlzUzNVZ3dYdlpReXdOTDZmTjVpNW9lai1xQXVtTWxERXZRdUFXTUk0OFB1MwEB
2019-02-15 10:12:40 SERVER -> CLIENT: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
2019-02-15 10:12:40 SMTP ERROR: AUTH command failed: 334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==
2019-02-15 10:12:40 SMTP Error: Could not authenticate.
2019-02-15 10:12:40 CLIENT -> SERVER: QUIT
2019-02-15 10:12:40 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials n184sm14639706wmf.5 - gsmtp
2019-02-15 10:12:40 SMTP ERROR: QUIT command failed: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials n184sm14639706wmf.5 - gsmtp
2019-02-15 10:12:40 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/TroubleshootingSMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting