473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 3007

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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.