Problem with Pear Mail_Mime

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George

    #1

    Problem with Pear Mail_Mime

    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 = 'webmaster@xxxx xxxx.com';

    /// MAKE "HEADERS" ARRAY AND POPULATE///////////////////
    $headers['From'] = 'info@xxxxxxxxx xx.com';
    $headers['Subject'] = 'Mailing Test';

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

    //////// ADD BODY PARTS ////////////////////////////
    $text = 'Text Version of Email';
    $mime->setTXTBody($te xt);

    $html = '<html><body>HT ML version of email</body></html>';
    $mime->setHTMLBody($h tml);

    //////// GET MIME FORMATTED BODY AND HEADERS////////////
    $body = $mime->get();
    $headers = $mime->headers($heade rs);

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


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

    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:

    Return-Path: <xxx@xxxx.net >
    Delivered-To: 1-webmaster@xxxxx xx.com
    Received: (qmail 19972 invoked by uid 48); 21 Sep 2005 19:09:48 -0400
    Date: 21 Sep 2005 19:09:48 -0400
    Message-ID: <20050921230948 .19939.qmail@xx xxxxx.net>
    To: webmaster@xxxxx xx.com
    Subject: Mailing Test
    MIME-Version: 1.0
    From: info@xxxxxxxx.c om
    Content-Type: multipart/alternative;
    boundary="=_266 f5fac0772f41edd 2f26172b50fc69"
    X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on
    xxxxxxxxxx.net
    X-Spam-Level:
    X-Spam-Status: No, hits=0.8 required=5.0 tests=HTML_20_3 0,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,
    George

  • John Dunlop

    #2
    Re: Problem with Pear Mail_Mime

    George wrote:
    [color=blue]
    > The full headers of the email are as follows:[/color]

    [...]

    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.)

    --
    Jock

    Comment

    Working...