SMTP Error: The following recipients failed:XXXX

Markus picture Markus · Aug 17, 2013 · Viewed 56.8k times · Source

So i just received this error when trying to send an mail using PHPmailer from my site.

SMTP Error: The following recipients failed: XXXX

I tried to set $mail->SMTPAuth = true; to false but no result. And i tried to change the password for the mail account and update that in the sendmailfile.php but still the same.

It worked as intended two days ago, now i don't know why this is happening. Since there ain't any error code either i don't really know where to begin and since it did work..

Anyone who might know?

    $mail = new PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->ContentType = 'text/html';
    $mail->IsSMTP();
    $mail->Host = "HOST.COM";
    $mail->SMTPAuth = true;
    $mail->Username = "MAIL_TO_SEND_FROM"; 
    $mail->Password = "PASSWORD"; 
    $mail->From = "MAIL_TO_SEND_FROM";
    $mail->FromName = "NAME";
    $mail->AddAddress($safeMail);
    $mail->AddReplyTo("[email protected]", "No-reply");
    $mail->WordWrap = 50;
    $mail->IsHTML(true);
    $sub = "SUBJECT";
    mail->Subject = ($sub);

Answer

user443346 picture user443346 · Apr 17, 2014

I've encountered the same problem. Managed too fix it when i commented the next row:

 $mail->isSMTP(); 

Noticed you already found an answer, however maybe this will fix the problem for other people.

This does prevent using your external SMTP server as RozzA stated in the comments.