468,247 Members | 1,324 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Trouble with PEAR class (Mail_Mime)

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
Jul 16 '05 #1
0 2771

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Arne Kösling | last post: by
3 posts views Thread by Ron King | last post: by
3 posts views Thread by junkmail | last post: by
1 post views Thread by praba kar | last post: by
reply views Thread by Alexander Waldmann | last post: by
reply views Thread by bwhitehd | last post: by
7 posts views Thread by daniyalnawaz | last post: by
2 posts views Thread by lawpoop | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.