Just as an FYI, the following line will get your email a lot of spam points in 
SpamAssassin:

$headers .= "X-MSMail-Priority: High\r\n";

Also, I don't know if this has already been suggested, but there is an awesome 
class named htmlMimeMail which will handle your needs perfectly. Google it 
and you will have everything you need.

-JEremy

On Friday 28 May 2004 05:49 am, Matt MacLeod wrote:
> I've been having a little trouble configuring a script to send a
> multipart email using PHP.
>
> The script send the message, but when I recieve the email it doesn't
> display the HTML version and I have to tell my mail client to displlay
> the plain text version (Mail on OS X 10.3.3).
>
> Here's the script:
>
> $headers .= "FROM: [EMAIL PROTECTED]";
> $headers .= "Reply-To: [EMAIL PROTECTED]";
> $nonhtml = strip_tags($emailsend);
> // This is the important part!
> // This content type identifies the content of the message.
> // The boundary delimits the plain text and html sections.
> // The value of the boundary can be anything - you can even use the
> same one we used here
> $headers .= "Content-Type: multipart/alternative;
> boundary=\"----=_NextPart_000_002C_01BFABBF.4A7D6BA0\"\n\n";
> $headers .= "X-Priority: 1\r\n";
> $headers .= "X-MSMail-Priority: High\r\n";
> $headers .= "X-Mailer: PHP/" . phpversion()."\r\n";
> $headers .= "X-Sender: [EMAIL PROTECTED]";
> $headers .= "Return-Path: [EMAIL PROTECTED]";
> // Now begin your message, starting with the delimiter we specified in
> the boundary
> // Notice that two extra dashes (--) are added to the delimiters when
> // They are actually being used.
> $message = '------=_NextPart_000_002C_01BFABBF.4A7D6BA0
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> ';
> $message .= $nonhtml;
>
> $message .='
> ';
>
>
> // Now begin your HTML message, starting with the delimiter
> // Also notice that we add another content-type line which
> // lets the mail client know to render it in HTML
> $message .= '------=_NextPart_000_002C_01BFABBF.4A7D6BA0
> Content-Type: text/html; charset=us-ascii
> Content-Transfer-Encoding: 7bit
> ';
> $message .= $emailsend.'
>
> ------=_NextPart_000_002C_01BFABBF.4A7D6BA0--';
>
> // Now send the mail.
> // The additional header, "-f [EMAIL PROTECTED]" is only required by
> // some configurations.
>
> echo $message;
> $v = '[EMAIL PROTECTED]';
>
> mail($v, "Test", $message ,$headers,"-f [EMAIL PROTECTED]");
>
>
>
> Any ideas would be gratefully received!
>
> Thanks,
> Matt

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to