Recommend this page to a friend! |
MIME E-mail message sending | > | All threads | > | SMTP disconnected after recipient... | > | (Un) Subscribe thread alerts |
|
Sjake It - 2009-02-11 15:59:43
I've got a bulk e-mail script which connects to a local smtp-server.
But when an e-mail is sent to an invalid e-mailaddress, the following error appears: 450 4.1.2 : Recipient address rejected: Domain not found The following e-mails get the same errors, although they are correct. This is the smtp-debug: C MAIL FROM:<newsletter@xxx.com> C RCPT TO:<recipient@invaliddomain.com> C DATA S 250 2.1.0 Ok S 450 4.1.2 <recipient@invaliddomain.com>: Recipient address rejected: Domain not found Disconnected. What to do? Is the correct way to start all over and reconnect?
Manuel Lemos - 2009-02-11 17:37:45 - In reply to message 1 from Sjake It
You may carry on because each delivery is independent.
Sjake It - 2009-02-11 20:05:13 - In reply to message 2 from Manuel Lemos
Thanks for your quick reply.
The messages aren't sent after the disconnected-message. They all get the error: 450 4.1.2 : Recipient address rejected: Domain not found Even though the e-mailaddresses are valid. So how do i carry on?
Manuel Lemos - 2009-02-11 21:57:59 - In reply to message 3 from Sjake It
It is returning the previous error. Just set the error variable to an empty string.
Sjake It - 2009-02-12 14:16:03 - In reply to message 4 from Manuel Lemos
Doesn't help.
Messages aren't being sent. This is the stripped code. I couldn't find a good example for a bulk html e-mail with alternative text so I created it myself, perhaps it's incorrect? <?php $email_message=new smtp_message_class; $email_message->SetBulkMail(1); $email_message->localhost=SMTP_LOCALHOST; $email_message->smtp_host=SMTP_HOST; $email_message->smtp_port=25; $email_message->smtp_ssl=0; $email_message->smtp_direct_delivery=0; $email_message->smtp_exclude_address=""; $email_message->smtp_user=''; $email_message->smtp_password=''; $email_message->smtp_pop3_auth_host=''; $email_message->smtp_realm=""; $email_message->smtp_workstation=""; $email_message->smtp_authentication_mechanism=""; $email_message->smtp_debug=1; $email_message->smtp_html_debug=1; $email_message->maximum_bulk_deliveries=100; $email_message->cache_body=0; $email_message->SetEncodedEmailHeader("From",$from_address,$from_name,'utf-8'); $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name,'utf-8'); $email_message->SetHeader("Return-Path",$error_delivery_address); $email_message->SetEncodedEmailHeader("Errors-To",$error_delivery_address,$error_delivery_name); $text_part = ''; $html_part = ''; $text_message = "Newsletter"; /* Create empty parts for the parts that will be personalized for each recipient. */ $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part); $email_message->CreateQuotedPrintableHTMLPart($text_message,"",$html_part); $alternative_parts=array( $text_part, $html_part ); $email_message->AddAlternativeMultipart($alternative_parts); $query = "SELECT * FROM message where message_status = '' limit 0,100"; try { $result = $this->db->query($query); } catch(Exception $e) { echo $e->getMessage(); return; } echo '<ol>'; while ($message = $result->fetchRow()) { /* Personalize the recipient address. */ $to_name = $message['message_name']; $to_address = $message['message_emailaddress']; $html_message = $message['message_content']; $text_message = strip_tags($html_message); $subject = $message['message_subject']; $email_message->SetEncodedEmailHeader("To",$to_address,$to_name); $email_message->SetEncodedHeader("Subject",$subject,'utf-8'); if(!$email_message->cache_body) { $recipient_text_part = ''; $recipient_html_part = ''; /* Create a personalized body part. */ $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"utf-8",$recipient_text_part); $email_message->CreateQuotedPrintableHTMLPart($html_message,"utf-8",$recipient_html_part); $email_message->ReplacePart($text_part,$recipient_text_part); $email_message->ReplacePart($html_part,$recipient_html_part); } /* Send the message checking for eventually acumulated errors */ $error = $email_message->Send(); for($recipient=0,Reset($email_message->invalid_recipients);$recipient<count($email_message->invalid_recipients);Next($email_message->invalid_recipients),$recipient++) echo "Invalid recipient: ",Key($email_message->invalid_recipients)," Error: ",$email_message->invalid_recipients[Key($email_message->invalid_recipients)],"\n"; if(strcmp($error,"")) { echo "<li>Error sending to: ".$to_address.": $error</li>"; $error = ''; } else { echo "<li>Mail send to: ".$to_address."</li>"; } } echo '</ol>'; $email_message->SetBulkMail(0); echo "Done!\n"; ?> This is the debug info: Resolving SMTP server domain "smtp.domain.net"... Connecting to host address "00.000.00.00" port 25... Connected to SMTP server "smtp.domain.net". S 220 postel.comp.com ESMTP Postfix (2.3.3) C EHLO localhost S 250-postel.comp.com S 250-PIPELINING S 250-SIZE 25600000 S 250-VRFY S 250-ETRN S 250-AUTH DIGEST-MD5 LOGIN PLAIN CRAM-MD5 S 250-AUTH=DIGEST-MD5 LOGIN PLAIN CRAM-MD5 S 250-ENHANCEDSTATUSCODES S 250-8BITMIME S 250 DSN C MAIL FROM:<newsletter@xxx.com> C RCPT TO:<recipient@invaliddomain.xxx> C DATA S 250 2.1.0 Ok S 450 4.1.2 <recipient@invaliddomain.xxx>: Recipient address rejected: Domain not found Disconnected. # Error sending to: recipient@invaliddomain.xxx: 450 4.1.2 : Recipient address rejected: Domain not found # Error sending to: recipient@VALIDdomain.xxx: 450 4.1.2 : Recipient address rejected: Domain not found # Error sending to: recipient@VALIDdomain2.xxx: 450 4.1.2 : Recipient address rejected: Domain not found
Manuel Lemos - 2009-02-12 14:39:57 - In reply to message 5 from Sjake It
You need to set the class error variable ($email_message->error) to an empty string. You are setting a local variable instead, which obviously has no effect.
Sjake It - 2009-02-12 19:53:38 - In reply to message 6 from Manuel Lemos
Great! It works!
Thanks for the quick responses! |
info at phpclasses dot org
.