Problem with Pear Mail_Mime

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've got an interesting problem that I just have not been able to
figure out.  I'm trying to use Mail_Mime to send multi-part/mixed
emails from a Linux server and I am having trouble getting everything
to work together correctly.  I recently migrated this client from one
Linux server to another, and unfortunatley have no access to the old
server to figure out what has changed or is different between the two.
Needless to say, the email used to work perfectly on the old server,
and doesn't on the new.  What's happening is that the email is not
being decoded by Outlook or Thunderbird, but looks perfectly fine when
viewed through Horde.  The attachments are even being converted into
garbage.  I tried using this script, just to test what was happening,
and that's when I decided it was time to see if anyone else had
experienced something similar.

The script I tested with is:

$to = '';

/// MAKE "HEADERS" ARRAY AND POPULATE///////////////////
$headers['From'] = '';
$headers['Subject'] = 'Mailing Test';

//////////// CREATE MIME OBJECT //////////////////
$mime = new Mail_mime();

//////// ADD BODY PARTS ////////////////////////////
$text = 'Text Version of Email';

$html = '<html><body>HTML version of email</body></html>';

$body = $mime->get();
$headers = $mime->headers($headers);

$message =& Mail::factory('mail');
$message->send($to, $headers, $body);

As you can see, very simple.  Outlook is displaying the email as this

Content-Type: text/plain; charset="ISO-8859-1"

Content-Transfer-Encoding: 7bit

Text Version of Email

With no hint of the rest of the email message.  The full headers of the
email are as follows:

Received: (qmail 19972 invoked by uid 48); 21 Sep 2005 19:09:48 -0400
Date: 21 Sep 2005 19:09:48 -0400
Subject: Mailing Test
MIME-Version: 1.0
Content-Type: multipart/alternative;
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on
X-Spam-Status: No, hits=0.8 required=5.0 tests=HTML_20_30,HTML_MESSAGE,
    NO_REAL_NAME autolearn=no version=2.63

Does anyone have any idea what I might be doing incorrectly or what
settings in the qmail/mail or php.ini I should be looking for to
correct this problem?

Thanks in advance,

Re: Problem with Pear Mail_Mime

George wrote:

Quoted text here. Click to load it


Stab in the dark:  there are extra CRLFs between each body part's  
headers, leaving MUAs to interpret them as data instead of headers.  
Each alternative would then take on default values, and recipients  
would therefore be presented with a text/plain version.  This would  
also account for the body part's headers occurring as data.

But let's see each body part's headers as well, the headers that  
accompany each alternative in your multipart message, if there are  
any.  That might shed some light.  Better still, let's see an entire  
message, preferably reduced to a bare minimum, which exemplifies the  
problem.  (Ctrl+U in Firebird gives access to the source.)


Site Timeline