Trouble with Mail_mime...

From: Date: Sat, 12 Jul 2003 03:45:27 +0000
Subject: Trouble with Mail_mime...
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6569@lists.php.net to get a copy of this message
I'm having some trouble with Mail_Mime... it looks as if it isn't handling the creation of headers transparently. Here's what I'm essentially doing: $MimeMesg = new Mail_mime(); $MimeMesg->setTxtBody($MessageBody); $MimeMesg->setHTMLBody($filledInTemplate); $MimeMesg->addHTMLImage($entry,'image/jpeg'); $headers = array( 'From' => $From, 'Subject' => $Subject); $MimeMesgHead = $MimeMesg->headers($headers); $MimeMesgBody = $MimeMesg->get(); $mail =& Mail::factory('mail'); $mail->send($Recipients,$MimeMesgHead,$MimeMesgBody); But when the message arrives in my mailbox, my mail cleint reads it as a big hunk of text (also, the image seems to not be attached). So I checked the message headers. What I found was that there was no Content-Type set, no encoding, and no content boundary defined. The first two are easy enough to fix... I just change my headers array like so: $headers = array( 'From' => $From, 'Subject' => $Subject, 'Content-Type' => 'multipart/mixed', 'Content-Transfer-Encoding' => '7bit', ); But here's the thing... the boundary *is* getting automatically generated for the body... and I don't know how to pull that specific boundary in the header. Yes, I guess I can pull it out with a regexp or something. I was just hoping to avoid having to do stuff like this (and like setting the Content-Type and Encoding for the whole mail message manually) by using the class. Is my understanding of how Mail_mime works off, or is the class somewhat broken? regards, Weston

« previous php.pear.general (#6569) next »