yogesh prajapati
yogesh prajapati

Reputation: 145

SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first

<?php
require("class.phpmailer.php");
require("class.smtp.php");
require("class.pop3.php");

$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use      SMTP
$mail->Host = "smtp.mail.yahoo.com";  // specify main and backup server
$mail->SMTPSecure = "SSL";
$mail->SMTPKeepAlive = true;
$mail->Port = "587";
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->SMTPDebug = 1;
$mail->Username = "[email protected]";  // SMTP username
$mail->Password = "xyz"; // SMTP password



$mail->From = "[email protected]";
$mail->FromName = "Prashant kumar";
$mail->AddAddress("[email protected]", "Yogesh");                 // name is    optional
$mail->AddReplyTo("[email protected]", "Information");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$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. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";
?>

Trying from last 2 days, getting the error as

SMTP -> ERROR: AUTH not accepted from server: 530 5.7.0 Must issue a STARTTLS command first

SMTP Error: Could not authenticate. Message could not be sent.

Mailer Error: SMTP Error: Could not authenticate.

Already seen all possible questions in stackoverflow and other websites. Already changed SMTPSecure and Port to all possible values. Tried gmail server and outlook server also. Changed SMTPsecure to STARTTLS and TLS also with respective ports. Removed SMTPAuth line also. Tried every possible soultions i found through web.

Is this because i am trying to run this on my localhost? (i am using XAMPP in windows 8, 64 bit)

Upvotes: 1

Views: 4372

Answers (1)

Drop Shadow
Drop Shadow

Reputation: 808

Try using $mail->Port = 465; instead of 587 and check the difference in the below link.

Upvotes: 0

Related Questions