I'm at a complete loss right now.
I did plenty of research regarding this issue. Some background: I'm sending a HTML email through PHP using PHPMailer. The problem is, it always ends up in the junk folder.
$message = "<html><u>Hello there</u></html>";
date_default_timezone_set('Etc/UTC');
$mail = new PHPMailer();
//even tried setting up SMTP server
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = "myGmailEmail@gmail.com";
$mail->Password = "my gmail password";
$mail->SMTPDebug = 2;
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->setFrom('noreply@promisingwebsite.com', 'No-reply');
$mail->addReplyTo('noreply@promisingwebsite.com', 'No-reply');
$mail->AddAddress($to);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->MsgHTML($message);
if($mail->send()) resp(true,$code);
else resp(false,"error (".$mail->ErrorInfo.")");
When I do not use SMTP, it sends the email which ends up in junk folder. When I DO use it, I cannot authenticate:
2016-11-26 12:44:16 CLIENT -> SERVER: EHLO 185.80.130.141
2016-11-26 12:44:16 CLIENT -> SERVER: STARTTLS
2016-11-26 12:44:16 CLIENT -> SERVER: EHLO 185.80.130.141
2016-11-26 12:44:16 CLIENT -> SERVER: AUTH LOGIN
2016-11-26 12:44:16 CLIENT -> SERVER: bmVkdWthczE3QGdtYWlsLmNvbQ==
2016-11-26 12:44:17 CLIENT -> SERVER: bmVkdWxpdWthczEyMw==
2016-11-26 12:44:17 SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbtT
534-5.7.14 KhjtVSQhqL8MciQEtofR0fc36pPSF1zUxFnNZCay9DTcpxzjY0-elaKn8oWgt_-7bXpCSU
534-5.7.14 L0sarBbOFwjA4l3lN_VmEDi1Pej1C4gHpfDiFnpC87Md82FK_qZe2B6J1olxCWnmQUQlWE
534-5.7.14 eIwqtsXjE3xia_Y-lJnGZu7uQeQ7L_4QYj452Xxllf6GjA9Pz-cJsanxzXl7NTqRKEhcGM
534-5.7.14 hTxqiKtVHXjFtkWZ_fGs5O960iNwk> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14 Learn more at
534 5.7.14 https://support.google.com/mail/answer/78754 e102sm10342631lfi.25 - gsmtp
2016-11-26 12:44:17 SMTP Error: Could not authenticate.
2016-11-26 12:44:17 CLIENT -> SERVER: QUIT
2016-11-26 12:44:17 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I have no idea what to do. I ran spamcheck tests but they return somewhat a negative result (email is not classified as spam). Thanks for your help.