I am really hoping one of you can help me. I've been pulling my hair out for about 2 hours with this. One of the accounts on my client's email servers got compromised and Google start blocking attempts for us to send emails. So I am trying to switch from the basic PHP mail command to PHPMailer and send through Google's SMTP server. This client uses Google Pro for all of his accounts.

I am using the following:

```
    $mail             = new PHPMailer();

    $mail->isSMTP(); // telling the class to use SMTP
    $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
    $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
    $mail->SMTPSecure = "tls";                 // sets the prefix to the server
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->Port       = 587;                   // set the SMTP port for the GMAIL server
    $mail->Username   = "no-reply@mydomain.com";  // GMAIL username
    $mail->Password   = "*********";            // GMAIL password

    $mail->SetFrom('no-reply@mydomain.com', 'Jimmy');

    $mail->Subject    = $this->subject;

    $body             = $this->message;
    //$body             = eregi_replace("[\]",'',$body);          

    $mail->MsgHTML($body);

    $mail->AddAddress($this->to, 'bob');

    if(!$mail->Send()) {
        error_log("Mailer Error: " . $mail->ErrorInfo);
        echo '[br /]Fail';
    } else {
        error_log("Message sent!");
        echo '[br /]Pass';
    }

```

I know the credentials are correct because I can login with them. I've done all kinds of stuff to this script and the account it is trying to use to send:

1. Change from TLS to SSL
2. 'unblock captcha' in the account
3. disabled 2 factor auth (it was already off)
4. enabled 'less secure apps'

I'm not sure what else to do. This is the error I keep getting:

```
2017-05-15 03:12:30   CLIENT -> SERVER: EHLO americanbeautytools.com
2017-05-15 03:12:30   CLIENT -> SERVER: STARTTLS
2017-05-15 03:12:30   CLIENT -> SERVER: EHLO americanbeautytools.com
2017-05-15 03:12:30   CLIENT -> SERVER: AUTH LOGIN
2017-05-15 03:12:30   CLIENT -> SERVER: xxx=
2017-05-15 03:12:30   CLIENT -> SERVER: xxx=
2017-05-15 03:12:32   SMTP ERROR: Password command failed: 535 Incorrect authentication data
2017-05-15 03:12:32   SMTP Error: Could not authenticate.
2017-05-15 03:12:32   CLIENT -> SERVER: QUIT
2017-05-15 03:12:32   SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

```

The part about password command failed is the part I don't get. How can that be wrong when I login with that email account just fine?

I have looked at about 15 of the threads on this topic and none of what they suggest solves my problem. This is a google pro account that my client runs through google so it wouldn't be the 'free' restriction thing.