| Recommend this page to a friend! |
| SMTP E-mail sending class | > | All threads | > | work correctly on local but not work... | > | (Un) Subscribe thread alerts |
| |||||||||||||||
hi
dear Manuel Lemos i test smtp_message_class on local computer and it works good but when i upload that on host server this error apear: Error: MISSING_MAILBOX_TERMINATOR .SYNTAX-ERROR. please help me tanks in advance best regards
That means you have a malformed address in an e-mail header. Make sure your e-mail names and addresses are well formatted.
i check headr and understand this:
when i try to send email to one person for example:[email protected] the email was sended correctly but when i try send email to multiple persons like this: [email protected] , [email protected] , [email protected] it not work correctly please help me mr Manuel Lemos how can i send email to multiple person tanks very very much
You cannot specify multiple addresses on a single string value. You need to specify one by one separately in the recipients array argument that you pass to the SendMessage function.
hi
dear Manuel Lemos can you guide me more how can i send email to more than 1 recipient in optimal way. can you send me an example.please best regards
If you look at the test_smtp.php example script, the SendMessage call takes an array of recipient addresses as second parameter. You should pass to that parameter an array with all recipients
$to_1 = '[email protected]'; $to_2 = '[email protected]'; $smtp->SendMessage( $from, array( $to_1, $to_2 ), array( "From: $from", "To: $to_1, $to_2", "Subject: Testing Manuel Lemos' SMTP class", "Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z") ), "Hello $to,\n\nIt is just to let you know that your SMTP class is working just fine.\n\nBye.\n");
some points about my problems:
1.i use mimemessage class and smtp class together for sending email with header involve not ascii characters 2.when i set multi recipients to "to" in header it works on local computer and send emails to all recipients but when i test exactlly that program on my host this error apear: "Error: MISSING_MAILBOX_TERMINATOR .SYNTAX-ERROR. " 3.when i set multi recipients to cc or bcc ,emails sended to all but with bad content like this: " [ No Subject ] ... From: "[email protected]" <[email protected]> ... View Contact To: Subject: =?UTF-8?q?=D8=AA=D8=B3=D8=AA?= From: =?UTF-8?q?=D8=AA=D8=B3=D8=AA?= <[email protected]> Reply-To: =?UTF-8?q?=D8=AA=D8=B3=D8=AA?= <تست> Return-Path: [email protected] Errors-To: =?UTF-8?q?farzaanco2=40gmail.com?= <[email protected]> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="62d8a9574d169bff6868f7d91183578d" Date: Thu, 23 Jun 2011 00:47:50 MDT Message-ID: <[email protected]> --62d8a9574d169bff6868f7d91183578d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <p>bcc</p> --62d8a9574d169bff6868f7d91183578d Content-Type: text/plain; name="attachment.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="attachment.txt" VGhpcyBpcyBqdXN0IGEgcGxhaW4gdGV4dCBhdHRhY2htZW50IGZpbGUgbmFtZWQgYXR0YWNobWVu dC50eHQgLg== --62d8a9574d169bff6868f7d91183578d Content-Type: image/gif; name="logo.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="logo.gif" R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v/////////////////// /////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2dDYldFWtNSFPiXssXnZR k5+1pjpBiDMJUXG/Jo7DI4eKfMSmxsJ9GAUB1NXW19jZ2tvc3d7f4OHi2AgZN5vom1kk6F7s6u/p m3Ab7AOIiCxOyZuBIv8AOeTJIaYQjiR/kKTr5GQNE3pYSjCJ9mUXClRUsLxaZGciC0X+OlpoOuQo ZKdNJnIoKfnxRUQh6FLG0iLxIoYnJd0JEKISJyAQDodp3EUDC48oDnUY7HFI3wEDRjzycQJVZCQT Ol7NK+G0qgtkAcOKHUu2rNmzYTVqRMt2bB49bHompSchqg6HcGeANSMxr8sEa2y2HexnSEUTuWri SSbkYh7BgGVAnhB1b2REibESYaRoBgqIMYx59tFM9AvQffVG49P5NMZkMlHKhJPJb0knmSKZ6kSX JtbeF3Am7ocok6c7cM7pU5xcXiJJETUz16qPrzEfaFgZpvzn7h86YV5r/1mxXeAUMVyEIpnVUGpN RlG2ka9b3lP3pm2l6u7P+l/YLj3+RlEHbz1C0kRxSITQaAcilVBMEzmkkEQO8oSOBNg9SN+AX6hV z1pjgJiAhwCRsY8ZIp6xj1ruqCgeGeKNGEZwLnIwzTg45qjjjjz2GEA5hAUp5JBEFmnkkSCoWEcZ X8yohZNK1pFGPQS4hx0qNSLJlk9wCQORYu5QiMd7bUzGVyNlRiOHSlpuKdGEItHQ3HZ18beRRyws YSY/waDTiHf/tWlWUBAJiMJ1/Z0XXU7N0FnREpKM4NChCgbyRDq9XYpOplaKopN9NMkDnBbG+UMC QwLWIeaiglES6AjGARcPHCWoVAiatcTnGTABZoLPaPG1phccPv366mEvWEFSLnj+2QaonECwcJt/ e1Zw3lJvVMmftBdVNQS3UngLCA85YHIQOy6JO9N4eZW7KJwtOUZmGwOMWqejwVW6RQzaikRHX3yI osKhDAq8wmnKSmdMwNidSOof9ZG2DoV0RfTVmLFtGmNk+CoZna0HQnPHS3AhRbIeDpqmR09E0bsu soeaw994z+rwQVInvqLenBftYjLOVphLFHhV9qsnez8AEUbQRgO737AxChjmyANxuEFHSGi7hFCV 4jxLst2N8sRJYU+SHiAKjlmCgz2IffbLI5aaQR71hnkxq1ZfHSfKata6YDCJDMAQwY7wOgzhjxgj VFQnKB5uX4mr9qJ79pann+VcfcSzsSCd2mw5scqRRvlQ6TgcUelYhu75iPE4JejrsJOFQAG01277 7bjnrvvuvPfu++/ABy887hfc6OPxyCevPDdAVoDA89BHL/301Fdv/fXYZ6/99tx3Pz0FEQAAOw== --62d8a9574d169bff6868f7d91183578d Content-Type: multipart/related; boundary="3ef000e8112bca32e6e49d814560c852" --3ef000e8112bca32e6e49d814560c852 Content-Type: multipart/alternative; boundary="7716588e2629093360b7d2cea53029a9" --7716588e2629093360b7d2cea53029a9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable This is an HTML message. Please use an HTML capable mail program to read this message. --7716588e2629093360b7d2cea53029a9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html> <head> <title>=D8=AA=D8=B3=D8=AA</title> <style type=3D"text/css"><!-- body { color: black ; font-family: arial, helvetica, sans-serif ; backgroun= d-color: #A3C5CC } A:link, A:visited, A:active { text-decoration: underline } --></style> </head> <body> <table background=3D"cid:b66d73260533c80f7981bf1e04ca380c.gif" width=3D"100= %"> <tr> <td> <center><h1>=D8=AA=D8=B3=D8=AA</h1></center> <hr> <P>Hello =D8=AA=D8=B3=D8=AA,<br><br> This message is just to let you know that the <a href=3D"http://www.phpclas= ses.org/mimemessage">MIME E-mail message composing and sending PHP class</a= > is working as expected.<br><br> <center><h2>Here is an image embedded in a message as a separate part:</h2>= </center> <center><img src=3D"cid:036a1925673771c9ee381b32ef300f85.gif"></center>Than= k you,<br> =D8=AA=D8=B3=D8=AA</p> </td> </tr> </table> </body> </html> --7716588e2629093360b7d2cea53029a9-- --3ef000e8112bca32e6e49d814560c852 Content-Type: image/gif; name="logo.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="logo.gif" Content-ID: <036a1925673771c9ee381b32ef300f85.gif> R0lGODlhlgAjAPMJAAAAAAAA/y8vLz8/P19fX19f339/f4+Pj4+Pz7+/v/////////////////// /////yH5BAEAAAkALAAAAACWACMAQwT+MMlJq7046827/2AoHYChGAChAkBylgKgKClFyEl6xDMg qLFBj3C5uXKplVAxIOxkA8BhdFCpDlMK1urMTrZWbAV8tVS5YsxtxmZHBVOSCcW9zaXyNhslVcto RBp5NQYxLAYGLi8oSwoJBlE+BiSNj5E/PDQsmy4pAJWQLAKJY5+hXhZ2dDYldFWtNSFPiXssXnZR k5+1pjpBiDMJUXG/Jo7DI4eKfMSmxsJ9GAUB1NXW19jZ2tvc3d7f4OHi2AgZN5vom1kk6F7s6u/p m3Ab7AOIiCxOyZuBIv8AOeTJIaYQjiR/kKTr5GQNE3pYSjCJ9mUXClRUsLxaZGciC0X+Ol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6OPxyCevPDdAVoDA89BHL/301Fdv/fXYZ6/99tx3Pz0FEQAAOw== --3ef000e8112bca32e6e49d814560c852 Content-Type: image/gif; name="background.gif" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="background.gif" Content-ID: <b66d73260533c80f7981bf1e04ca380c.gif> R0lGODlh+wHCAPMAAKPFzKLEy6HDyqHCyaDByJ/Ax56/xp2+xZ28xJy7w5u6wpq5wZm4wJm3v5i2 vpe1vSwAAAAA+wHCAEME/hDISau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqP yKRyyWw6n9CodEqtWq+gwSHReHgfjobY8X00FIc019tIHAYS7dqcQCDm3vC4fD4QAhUBBFsMZF8O hnkLCAYFW11tb1iTlJWWOXJdZZtmC24Eg3hgYntfbXainJ2fgBSZbG5wFAG0E6+RoAZ3CbwJCgya p3cMbAyevQcFAgMGCcRmxr1uyszOxQq+wF4MdcPFx7zJApfk5eYhr3SSGemRsu3dc+4iAqELhZwO 0X6hkHUHCBRoGtUg0RkEAAUeKhhGAcICBQIODIPooIEBzCTmKcjGYSNd/go3VvQo65zJkyhTqlzJ sqXLlzBjypxJs6bNmzhz6tzJs6fPn0CDCh1KtKjRo0iTKl3KtKnTp1CXBhhAwECaq1gPNCIwANDU qmkMcG311apWULmyZt3alcPXAma1FgAlgCxVq2LbRt3LF0Y7hwWoEjLEDZUmff8AOjMkTB5gwYu3 JbhIQUDEZw+4+aE1aNc0R2vcDYjoDBgpBoUDj95yzzRqbH7qgW4t5vUnAfVAoj7NwOOf1QloN7Ad u1Xf41b+IlCNsa6rR7DWwTPccTnG5sYvCEKwgPGiZI64A9OsK/Q/BM/0YfuFz13VOwsULLhHps+f 98Hl0zeDRk0X9Qih/vLPWPjFN197aPyB3IJVBLDMdc5t4OB1A0QowYQQ0vIgdilgyGEgG1roYV0j GufhhyBSWGF2s2yIYosqWsjgjDTWaOONOOao44489ujjj0AGKeSQRBZp5JFIJqnkkkw26eSTUMJU llpYseXVXWG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Wl3k2zXiPBVd3nXV3PHOkRpgk5A lYlgg2F8Fw3WlnZW9HiCB2Q0Y3ic8k2Kl5V4JQhUiXgWFgqUh1e9h3mcpy2epxdm+XnjQ1EiMHoQ pVtogiWuV3urBxGod4Xnw41huJfjKHvtg3t8GYKEWZiGeZiImZiKuZiM2ZiO+ZiQGZmSOZmUWZmW eZmYmZmauZmc2ZlCEQEAOw== --3ef000e8112bca32e6e49d814560c852-- --62d8a9574d169bff6868f7d91183578d-- " ************************************************************************** this is my code ########################################################################## <?php /* * test_smtp_message.php * * @(#) $Header: /home/mlemos/cvsroot/mimemessage/test_smtp_message.php,v 1.15 2011/03/09 07:48:52 mlemos Exp $ * */ require("email_message.php"); require("smtp_message.php"); require("smtp.php"); require 'db_fns.php'; /* Uncomment when using SASL authentication mechanisms */ require("sasl.php"); $from_name=$_POST['from_name']; $from_address=$_POST['from_address']; $sender_line=__LINE__; $reply_name=$_POST['to_name']; $reply_address=$_POST['to_address']; // $reply_address=$from_address; $error_delivery_name="[email protected]"; $error_delivery_address="[email protected]"; $to_name=$_POST['to_name']; // $to_address="[email protected],[email protected],[email protected]"; $recipient_line=__LINE__; $to_categories = $_POST["to_address"]; $subject=$_POST['subject']; $message=$_POST['body']; if(strlen($from_address)==0) die("Please set the messages sender address in line ".$sender_line." of the script ".basename(__FILE__)."\n"); if(strlen($to_address)==0) die("Please set the messages recipient address in line ".$recipient_line." of the script ".basename(__FILE__)."\n"); $email_message=new smtp_message_class; /* This computer address */ $email_message->localhost="localhost"; /* SMTP server address, probably your ISP address, * or smtp.gmail.com for Gmail * or smtp.live.com for Hotmail */ $email_message->smtp_host="smtp.gmail.com"; /* SMTP server port, usually 25 but can be 465 for Gmail */ $email_message->smtp_port=465; /* Use SSL to connect to the SMTP server. Gmail requires SSL */ $email_message->smtp_ssl=1; /* Use TLS after connecting to the SMTP server. Hotmail requires TLS */ $email_message->smtp_start_tls=0; /* Change this variable if you need to connect to SMTP server via an HTTP proxy */ $email_message->smtp_http_proxy_host_name=''; /* Change this variable if you need to connect to SMTP server via an HTTP proxy */ $email_message->smtp_http_proxy_host_port=3128; /* Change this variable if you need to connect to SMTP server via an SOCKS server */ $email_message->smtp_socks_host_name = ''; /* Change this variable if you need to connect to SMTP server via an SOCKS server */ $email_message->smtp_socks_host_port = 1080; /* Change this variable if you need to connect to SMTP server via an SOCKS server */ $email_message->smtp_socks_version = '5'; /* Deliver directly to the recipients destination SMTP server */ $email_message->smtp_direct_delivery=0; /* In directly deliver mode, the DNS may return the IP of a sub-domain of * the default domain for domains that do not exist. If that is your * case, set this variable with that sub-domain address. */ $email_message->smtp_exclude_address=""; /* If you use the direct delivery mode and the GetMXRR is not functional, * you need to use a replacement function. */ /* $_NAMESERVERS=array(); include("rrcompat.php"); $email_message->smtp_getmxrr="_getmxrr"; */ /* authentication user name */ $email_message->smtp_user="[email protected]"; /* authentication password */ $email_message->smtp_password="***********"; /* if you need POP3 authetntication before SMTP delivery, * specify the host name here. The smtp_user and smtp_password above * should set to the POP3 user and password*/ $email_message->smtp_pop3_auth_host=""; /* authentication realm or Windows domain when using NTLM authentication */ $email_message->smtp_realm=""; /* authentication workstation name when using NTLM authentication */ $email_message->smtp_workstation=""; /* force the use of a specific authentication mechanism */ $email_message->smtp_authentication_mechanism=""; /* Output dialog with SMTP server */ $email_message->smtp_debug=0; /* if smtp_debug is 1, * set this to 1 to make the debug output appear in HTML */ $email_message->smtp_html_debug=1; /* If you use the SetBulkMail function to send messages to many users, * change this value if your SMTP server does not accept sending * so many messages within the same SMTP connection */ $email_message->maximum_bulk_deliveries=100; /*$to=array( array( "address"=>"[email protected]", "name"=>"Peter Gabriel" ), array( "address"=>"[email protected]", "name"=>"Paul Simon" ), array( "address"=>"[email protected]", "name"=>"Mary Chain" ) );*/ //$email_message->SetMultipleEncodedEmailHeader("to",$to); $to_address="[email protected],[email protected],[email protected],[email protected],[email protected]"; $email_message->SetEncodedEmailHeader("To",$to_address,$to_name); $email_message->SetEncodedEmailHeader("From",$from_address,$from_name); $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name); $email_message->SetHeader("Return-Path",$error_delivery_address); $email_message->SetEncodedEmailHeader("Errors-To",$error_delivery_address,$error_delivery_name); $email_message->SetEncodedHeader("Subject",$subject); $email_message->AddQuotedPrintableTextPart($email_message->WrapText($message)); $text_attachment=array( "Data"=>"This is just a plain text attachment file named attachment.txt .", "Name"=>"attachment.txt", "Content-Type"=>"automatic/name", "Disposition"=>"attachment" ); $email_message->AddFilePart($text_attachment); $image_attachment=array( "FileName"=>"http://www.phpclasses.org/graphics/logo.gif", "Content-Type"=>"automatic/name", "Disposition"=>"attachment" ); $email_message->AddFilePart($image_attachment); // **********************************************************************htmlWithembededImage $image=array( "FileName"=>"http://www.phpclasses.org/graphics/logo.gif", "Content-Type"=>"automatic/name", "Disposition"=>"inline", /* * You can set the Cache option if you are going to send the same message * to multiple users but this file part does not change. * "Cache"=>1 */ ); $email_message->CreateFilePart($image,$image_part); /* * Parts that need to be referenced from other parts, * like images that have to be hyperlinked from the HTML, * are referenced with a special Content-ID string that * the class creates when needed. */ $image_content_id=$email_message->GetPartContentID($image_part); /* * Many related file parts may be embedded in the message. */ $image=array( "FileName"=>"http://www.phpclasses.org/graphics/background.gif", "Content-Type"=>"automatic/name", "Disposition"=>"inline", /* * You can set the Cache option if you are going to send the same message * to multiple users but this file part does not change. * "Cache"=>1 */ ); $email_message->CreateFilePart($image,$background_image_part); /* * Related file parts may also be embedded in the actual HTML code in the * form of URL like those referenced by the SRC attribute of IMG tags. * This example is commented out because not all mail programs support * this method of embedding images in HTML messages. * * $image=array( * "FileName"=>"http://www.phpclasses.org/graphics/elephpant_logo.gif", * "Content-Type"=>"automatic/name", * ); * $image_data_url=$email_message->GetDataURL($image); */ /* * Use different identifiers to reference different related file parts. * Some e-mail programs do not support setting the background image in the * body tag or style. A workaround consists on using a table with 100% * with the background attribute set to the image URL. */ $background_image_content_id="cid:".$email_message->GetPartContentID($background_image_part); /* * The URL of referenced parts in HTML starts with cid: * followed by the Contentp-ID string. Notice the image link below. */ $html_message="<html> <head> <title>$subject</title> <style type=\"text/css\"><!-- body { color: black ; font-family: arial, helvetica, sans-serif ; background-color: #A3C5CC } A:link, A:visited, A:active { text-decoration: underline } --></style> </head> <body> <table background=\"$background_image_content_id\" width=\"100%\"> <tr> <td> <center><h1>$subject</h1></center> <hr> <P>Hello ".strtok($to_name," ").",<br><br> This message is just to let you know that the <a href=\"http://www.phpclasses.org/mimemessage\">MIME E-mail message composing and sending PHP class</a> is working as expected.<br><br> <center><h2>Here is an image embedded in a message as a separate part:</h2></center> <center><img src=\"cid:".$image_content_id."\"></center>". /* * This example of embedding images in HTML messages is commented out * because not all mail programs support this method. * * <center><h2>Here is an image embedded directly in the HTML:</h2></center> * <center><img src=\"".$image_data_url."\"></center> */ "Thank you,<br> $from_name</p> </td> </tr> </table> </body> </html>"; $email_message->CreateQuotedPrintableHTMLPart($html_message,"",$html_part); /* * It is strongly recommended that when you send HTML messages, * also provide an alternative text version of HTML page, * even if it is just to say that the message is in HTML, * because more and more people tend to delete HTML only * messages assuming that HTML messages are spam. */ $text_message="This is an HTML message. Please use an HTML capable mail program to read this message."; $email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part); /* * Multiple alternative parts are gathered in multipart/alternative parts. * It is important that the fanciest part, in this case the HTML part, * is specified as the last part because that is the way that HTML capable * mail programs will show that part and not the text version part. */ $alternative_parts=array( $text_part, $html_part ); $email_message->CreateAlternativeMultipart($alternative_parts,$alternative_part); /* * All related parts are gathered in a single multipart/related part. */ $related_parts=array( $alternative_part, $image_part, $background_image_part ); $email_message->AddRelatedMultipart($related_parts); // ********************************************************************** $error=$email_message->Send(); for($recipient=0,Reset($email_message->invalid_recipients);$recipient<count($email_message->invalid_recipients);Next($email_message->invalid_recipients),$recipient++){ //$i=0; echo "Invalid recipient: ",Key($email_message->invalid_recipients)," Error: ",$email_message->invalid_recipients[Key($email_message->invalid_recipients)],"\n"; } //header("location:login.htm"); if(strcmp($error,"")){ // header("location:index.htm"); echo "Error: $error\n"; } else{ // header("location:send.htm"); echo "با موفقیت ارسال شد\n"; } ?> </body> </html> ########################################################################## dear Manuel Lemos i am realy sory for my time consuming question and bad English lanquage please help me tanks in advance bye |
info at phpclasses dot org.
