Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #14597 Factory with smtp and Mime gets email wrong
Submitted: 2008-09-04 20:07 UTC
From: rvwilliams Assigned: alec
Status: Closed Package: Mail_Mime (version 1.5.2)
PHP Version: 4.4.4 OS: Debian Etch
Roadmaps: (Not assigned)    
Subscription  


 [2008-09-04 20:07 UTC] rvwilliams (Richard Williams)
Description: ------------ The email created by the code below wrongly includes the Content-Type and Content-Transfer-Encoding lines so is never recognized as HTML. Change the Factory from 'smtp' to 'mail' and the email is correct by of course not sent via the supplied $host. Test script: --------------- function new_mail($from,$to,$subject,$html,$host,$username,$password){ ini_set("include_path", ":"."/usr/share/php/"); require_once "Mail.php"; require_once "Mail/mime.php"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $message=new Mail_mime(); $message->setHTMLBody($html); $body=$message->get(); $headers=$message->headers($headers); $mail =& Mail::factory('smtp',array ('host' => $host,'debug'=>true,'port'=>2525,'auth' => true,'username' => $username,'password' => $password)); $mail1 = $mail->send($to, $headers, $body); if (PEAR::isError($mail1)) { die("<p>" . $mail1->getMessage() . "</p>"); } else { return(true); } } Expected result: ---------------- I expect to see this: Position: b a-Africa_Fact_Book_(tmr)_-_Name: a c-Company_Name: c chosen: North Africa d-Address: d e-Postcode: e f-Country: f g-E-mail: g g-Web: h h-Phone: i What I actually see is this: Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable <HTML><HEAD></HEAD><BODY> Position: b a-Africa_Fact_Book_(tmr)_-_Name: a c-Company_Name: c chosen: North Africa d-Address: d e-Postcode: e f-Country: f g-E-mail: g g-Web: h h-Phone: i </BODY></HTML> Actual result: -------------- DEBUG: Recv: 220 cmsinfo.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at Thu, 4 Sep 2008 20:50:27 +0100 DEBUG: Send: EHLO localhost DEBUG: Recv: 250-xxxxxx.com Hello [91.192.192.107] DEBUG: Recv: 250-TURN DEBUG: Recv: 250-SIZE DEBUG: Recv: 250-ETRN DEBUG: Recv: 250-PIPELINING DEBUG: Recv: 250-DSN DEBUG: Recv: 250-ENHANCEDSTATUSCODES DEBUG: Recv: 250-8bitmime DEBUG: Recv: 250-BINARYMIME DEBUG: Recv: 250-CHUNKING DEBUG: Recv: 250-VRFY DEBUG: Recv: 250-X-EXPS GSSAPI NTLM LOGIN DEBUG: Recv: 250-X-EXPS=LOGIN DEBUG: Recv: 250-AUTH GSSAPI NTLM LOGIN DEBUG: Recv: 250-AUTH=LOGIN DEBUG: Recv: 250-X-LINK2STATE DEBUG: Recv: 250-XEXCH50 DEBUG: Recv: 250 OK DEBUG: Send: AUTH LOGIN DEBUG: Recv: 334 VXNlcm5hbWU6 DEBUG: Send: c3R1ZGVudA== DEBUG: Recv: 334 UGFzc3dvcmQ6 DEBUG: Send: Mll3Mk1MY24= DEBUG: Recv: 235 2.7.0 Authentication successful. DEBUG: Send: EHLO localhost DEBUG: Recv: 250-xxxxxx.com Hello [91.192.192.107] DEBUG: Recv: 250-TURN DEBUG: Recv: 250-SIZE DEBUG: Recv: 250-ETRN DEBUG: Recv: 250-PIPELINING DEBUG: Recv: 250-DSN DEBUG: Recv: 250-ENHANCEDSTATUSCODES DEBUG: Recv: 250-8bitmime DEBUG: Recv: 250-BINARYMIME DEBUG: Recv: 250-CHUNKING DEBUG: Recv: 250-VRFY DEBUG: Recv: 250-X-EXPS GSSAPI NTLM LOGIN DEBUG: Recv: 250-X-EXPS=LOGIN DEBUG: Recv: 250-AUTH GSSAPI NTLM LOGIN DEBUG: Recv: 250-AUTH=LOGIN DEBUG: Recv: 250-X-LINK2STATE DEBUG: Recv: 250-XEXCH50 DEBUG: Recv: 250 OK DEBUG: Send: MAIL FROM: DEBUG: Recv: 250 2.1.0 admin@xxxxxx.com....Sender OK DEBUG: Send: RCPT TO: DEBUG: Recv: 250 2.1.5 keithw@xxxxxx.com DEBUG: Send: DATA DEBUG: Recv: 354 Start mail input; end with . DEBUG: Send: MIME-Version: 1.0 From: CMS Email Administrator To: keithw@xxxxxx.com Subject: Africa Fact Book Registration (tmr) Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable Position: b a-Africa_Fact_Book_(tmr)_-_Name: a c-Company_Name: c chosen: North Africa d-Address: d e-Postcode: e f-Country: f g-E-mail: g g-Web: h h-Phone: i . DEBUG: Recv: 250 2.6.0 Queued mail for delivery DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 xxxxxx.com Service closing transmission channel

Comments

 [2009-12-18 19:24 UTC] alec (Aleksander Machniak)
-Status: Open +Status: Closed -Assigned To: +Assigned To: alec
Works for me with SVN version. We need a better test case. Reopen if needed.