Jump to content

Recommended Posts

Hello all,

I've been trying to figure out this problem for days now - it's something that I "inherited" from the previous developer who worked for my present company, so this is especially difficult, as you can imagine.

Basically, I got an admin page on my site, which allows the admin to send a mass email to all the subscribers. The email itself is composed using a .tpl file, with all the fields being pulled from different variables.

Now, the problem is that if I use "text/html" content type, the HTML in the email does not get represented as it should be. When I use "multipart/alternative", the HTML is OK (at least in Thunderbird - there are still problems in Entourage), but somewhere in the process the header information gets attached to the top of the email body:

 

From - Mon Jul 30 15:29:31 2007 X-Account-Key: account2 X-UIDL: UID745-1181575263 X-Mozilla-Status: 0001 X-Mozilla-Status2: 00000000 X-Mozilla-Keys: Return-Path: Delivered-To: 3-ilia@company.com Received: (qmail 20389 invoked from network); 30 Jul 2007 15:23:15 -0500 Received: from company.com (HELO localhost) (216.70.127.231) by company.com with SMTP; 30 Jul 2007 15:23:15 -0500 From: Company Reply-To: Company Subject: Subject MIME-Version: 1.0 Content-Type: multipart/alternative boundary: ECHOTAG

 

This is the code that composes the headers and sends the email:

 

$headers = array('From' => 'Company<do-not-reply@company.com>',
                 'Reply-To' => 'Company<do-not-reply@company.com>',
                 'Subject' => "$journalName TOC Alert: Volume $volume, Issue $issue",
                 'MIME-Version' => '1.0',
                 'Content-Type' => 'multipart/alternative',
                 'boundary' => 'ECHOTAG');

......

$smarty->assign( 'user',              $users[$i] );
  $mailMessage = $smarty->fetch("email.toc_alert.html.tpl");
  $message= str_replace("\\\"","'",$mailMessage);
    //$email=$users[$i]->email;
  $email = "ilia@company.com";



  $mail = $smtp->send($email, $headers, $message);

 

And all this is done on a Linux server.

 

Appreciate any help in advance,

ilia

Link to comment
https://forums.phpfreaks.com/topic/62535-mail-problem-headers-part-of-body/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.