Menu

#83 SMTP Errors

closed
nobody
None
5
2012-09-18
2008-01-04
Anonymous
No

I'm using PHPmailer to send mail from a PHP script on one server through the SMTP server on a different server. Almost every time, a large percentage (25-50%) of the messages fail, but the rest are sent successfully. The email addresses that fail are all valid and formatted properly. The error log generated from the PHPmailer script gives one of the following errors for each of the failed messages:

SMTP Error: Could not connect to SMTP host.
SMTP Error: Data not accepted.

Here is our code (actual data has been changed for security reasons, and the database looping code has been removed):

IsSMTP(); $mail->SMTPKeepAlive = 'true'; $mail->Host = "mail.server.com"; // SMTP server $mail->SMTPAuth = "true"; $mail->Username = "phpmailer@server.com"; $mail->Password = "password"; $mail->Timeout = "60"; $mail->SMTPDebug = "true"; $mail->From = $returnemail; $mail->FromName = "Company Name"; $mail->AddAddress($email); $mail->Subject = stripslashes($subject); $mail->Body = $newsletter; $mail->IsHTML(true); if(!$mail->Send()) { $errorlist = $errorlist."
".$email.' | '.$mail->ErrorInfo; ++$errorcount; } $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->SmtpClose(); ?>

Can anyone help point us in the right direction on how to troubleshoot this? If it makes any difference, this script above is repeated 4 times on the same page through IF statements (i.e. if they select "Active Customers" it loops the database and sends to them, then if they've also selected "Inactive Customers" it loops the database again and sends to that group, and so on). I only mention it in case the script doesn't work well in multiple instances (though I'm not sure why it would matter). The total email traffic is roughly 600-800 emails per newsletter (each sent as an individual "To"). We've verified from our hosting company (MediaTemple Dedicated Virtual Server) that there are no outgoing email restrictions.

Any advice you can give on how to fix this critical issue would be most appreciated.

Thanks!

Discussion

  • Andy Prevost (CodeworxTech)

    Logged In: YES
    user_id=1711449
    Originator: NO

    If your version of PHP is greater than 4.2.3, there is a distinct possibility that the exit code received from your smtp server after sending each email is not interpreted properly. A fix for this issue is in the next release of PHPMailer v2.0.1 on March 24 2008.

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).