0

i only find old threads about this. But can't you send email's with PHPMailer and gmail smtp anymore?

I only get error that the password command failed and they want me to login trough the browser and try again..

require 'phpmail/PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'username';                 // SMTP username
$mail->Password = 'pwd';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('to@hotmail.com', 'Joe User');     // Add a recipient
$mail->addAddress('ellen@example.com');               // Name is optional
$mail->addReplyTo('info@example.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}
Tommy
  • 617
  • 1
  • 9
  • 22
  • When i check the email i get from google team it says im using an app that doesn't follow the modern standards. – Tommy Nov 16 '15 at 19:50
  • qhat it mean app? app that doesn't follow the modern standards – Hardy Mathew Nov 16 '15 at 19:51
  • I haven't tested it, but [this](https://support.google.com/mail/answer/22370?hl=en) may explain what your problem is. Have you checked these settings in the account? – Henry A. Nov 16 '15 at 19:56

0 Answers0