Gmail has begun introducing a new authentication mechanism that replaces SMTP authentication for OAuth2-based authorization. Documents about their changes can be found here .
This really does not improve security, because ultimately you still need to send your username and password over SSL at some point (the mechanism itself, which Google considers unsure) for authentication, in order to get an OAuth token that is just as secure as well as existing SMTP authorization systems.
While PHPMailer does not support this new mechanism - welcome PR! You will need an OAuth2 class, like this one , and maybe use this sample code .
" ", SMTPSecure = 'tls' Port = 587 auth PHPMailer.
Update
PHPMailer Gmail XOAUTH2 5.2.11. . . 6.0 .