you need to use oauth authentication. here's a phpmailer page - https://github.com/PHPMailer/PHPMailer/wiki/Using-Gmail-with-XOAUTH2