I have been struggling with this error for two days. But I don't know what is going on.
Everything was working well using phpMailer and a gmail account. Since gmail has a daily send limit we wanted to using sparkPost instead. Then, when we changed the user to the sparkPost one, we noticed that some emails were failing.
We have this phpmailer code:
$mail = new PHPMailer();
$mail->SMTPDebug = 1;
$mail->isSMTP();
$mail->Host = 'smtp.sparkpostmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->IsHTML(true);
$mail->CharSet = "UTF-8";
$mail->SMTPAuth = true;
$mail->Username = ''; //Sparkpost user
$mail->Password = ''; //Sparkpost pass
$mail->setFrom($from, 'From Alias');
$mail->addAddress($recipient);
$mail->Subject = html_entity_decode( $subject , ENT_QUOTES, 'UTF-8') ;
$mail->Body = $body;
$send = $mail->Send();
if (!$send) {
$loginfo .= "Mailer Error: " . $mail->ErrorInfo . "\n";
//Sends an email when the error ocurrs
} else {
$loginfo .= "Mail has been sent";
//OK
}
I have tried with 3 different email addresses insithe the setFrom() but all of them have failed at least once. I say this because is not always failing. For example, With the last address I have tried, we have 21 emails sent, only 2 of them have failed with this error.
EDIT This is the information I get with SMTPDebug = 2:
SMTP Error: Data not accepted.
SMTP server error: 2.0.0 RCPT TO accepted
DebugInfo: SMTP -> FROM SERVER:220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.27.58261 r(Core:4.2.27.6) Wed, 11 Jan 2017 12:07:04 +0000
SMTP -> FROM SERVER: 250-momentum5.platform1.us-west-2.aws.cl.messagesystems.com says EHLO to 54.154.106.22:35238 250-8BITMIME 250-STARTTLS 250-AUTH=LOGIN PLAIN 250-AUTH LOGIN PLAIN 250-PIPELINING 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:220 2.0.0 continue
SMTP -> FROM SERVER: 250-momentum5.platform1.us-west-2.aws.cl.messagesystems.com says EHLO to 54.154.106.22:35238 250-8BITMIME 250-AUTH=LOGIN PLAIN 250-AUTH LOGIN PLAIN 250-PIPELINING 250 ENHANCEDSTATUSCODES
SMTP -> ERROR: Password not accepted from server:
SMTP -> FROM SERVER:235 2.0.0 Authed. Go on.
SMTP -> ERROR: RSET failed: 235 2.0.0 Authed. Go on.
SMTP -> FROM SERVER:250 2.0.0 RSET OK
SMTP -> FROM SERVER:250 2.0.0 MAIL FROM accepted
SMTP -> FROM SERVER:250 2.0.0 RCPT TO accepted
SMTP -> ERROR: DATA command not accepted from server: 250 2.0.0 RCPT TO accepted
SMTP Error: Data not accepted.
Any idea? Thanks in advance
SMTP server error:
SMTP server error:
– Adrián Rodriguez Jan 10 '17 at 15:29