Jump to content

Mail PHP MIME


cartaysm

Recommended Posts

I sent an MIME email to an outlook account using Mail() and the HTML part was placed as an attachment for some reason.  I dont get caught by most spam filters (just outlook and my school) but I wanted to get this worked out so I dont get caught by any spam filters.  Can someone please take a look at my email system below and let me know if everything looks correct?

 

Just in case you need this; I am using PostFix, Zimbra, running on Debian 6.0 (php5)

 

//add From: header

$headers = 'From:' . $from . "\n";

$headers .= 'Reply-To:' . $from . "\n";

$headers .= 'Return-Path:' . $from . "\n";

 

//specify MIME version 1.0

$headers .= "MIME-Version: 1.0\n";

 

//unique boundary

$boundary = uniqid("market");

 

//tell e-mail client this e-mail contains//alternate versions

$headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n";

 

 

//plain text version of message

$body = "--$boundary\r\n" .

  "Content-Type: text/plain; charset=ISO-8859-1\r\n" .

  "Content-Transfer-Encoding: base64\r\n\r\n";

            //adds the remove to the string

$body .= chunk_split(base64_encode($plaintxt));

 

 

//HTML version of message

$body .= "--$boundary\r\n" .

  "Content-Type: text/html; charset=ISO-8859-1\r\n" .

  "Content-Transfer-Encoding: base64\r\n\r\n";

$body .= chunk_split(base64_encode($htmltxt));

 

$message = stripcslashes($body);

$subject = stripcslashes($subject);

 

        mail($to1[$i], $subject, $message, $headers, "-f $from");

 

Link to comment
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.