472,993 Members | 2,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

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 2981

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before...
3
by: Ron King | last post by:
When I installed Mandrake 10.0 I thought I had Apache, PHP, and MySQL installed correctly. I could serve web pages, MySQL worked, and when I tried the phpinfo() function, I got a page that looked...
3
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts...
1
by: praba kar | last post by:
Dear All, email.Message module base we can build message for mailing services which is like php Mail_mime module. In php Mail_mime module willautomatically build all the header fields like...
0
by: Alexander Waldmann | last post by:
Hi, i have PEAR::SOAP installed correctly (beta, all dependent packages are installed). When i try out the following simple Script <?php print "Include is ... ";...
0
by: bwhitehd | last post by:
I'm having a problem installing php. The compile seems to go fine, but when it gets to the install step I get the following errors. Does anyone have an idea of what might be the problem? We...
7
by: daniyalnawaz | last post by:
Hi! Im trying to send a html mail through PEAR but what I get in mail is blank email. Below is my code require_once "Mail.php"; require_once "Mail\mime.php";
2
by: lawpoop | last post by:
Hello all -- I'm having a problem getting images to appear in the body of an HTML email using PEAR's mail_mime class. Here's my code, what am I doing wrong? include("Mail.php");...
0
by: kronus | last post by:
Hey everyone, I am stumped once more and you guys have always helped in one way or the other. I am just now starting to fool around with using PEAR to send html emails. Following the sample...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.