You are here: Trouble with sending multipart Email « All PHP « IT news, forums, messages
Trouble with sending multipart Email

Posted by Disco Octopus on 10/30/05 12:15

Hi,

I am having a bit of difficulty when sending mail() with multipart.

Under a Windows server, it is working nicely. I am receiving the email
message in HTML.

Howver, When I run the code under a Unix server the emails I am receiving a
the entire raw message in the message body of my Outlook client.

Here is the PHP that is running....



if (empty($to)){
return(false);
}

if (empty($from)){
return(false);
}

$headers = "";
$headers .= "From: Speed Queen <$from>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "To: $toname <$to>\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "X-Mailer: PHP" . "phpversion()\r\n";
$headers .= "X-Sender: $from\r\n";
$headers .= "Return-Path: $from\r\n";
$headers .= "Content-Type: multipart/alternative;
boundary=$boundary\r\n\r\n";

//message to people with clients who don't
//understand MIME
$headers .= "This is a MIME encoded message\r\n\r\n";

$body = "";
//plain text version of message
$body .= "--$boundary\r\n";
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$body .= $body_plain;

//HTML version of message
$body .= "--$boundary\r\n";
$body .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$body .= $body_html;

$body .= "\r\n";

return (mail($to, $subject, $body, $headers));



Can anyone see anyting in here that could be made "nicer" or that would be
a reason why when run on a different server, different results are seen?

Thanks

--
a beef jerky site http://www.choicebeefjerky.com.au
not a beef jerky site http://mycoolwheels.com/vote.cmks
nobody ever dreams of working for the man

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация