multe-media Posted September 26, 2006 Share Posted September 26, 2006 Please someone help me with this. I been trying to get it working forever now.[code]<?php # Is the OS Windows or Mac or Linux if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol="\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol="\r"; } else { $eol="\n"; } ?> <?php # To Email Address $emailaddress="address@address.com"; # Message Subject $emailsubject="Heres An Email with a PDF"; # Common Headers $headers .= 'From: Test <test@address.com>'.$eol; $headers .= 'Reply-To: Test <test@address.com>'.$eol; $headers .= 'Return-Path: Test <test@address.com>'.$eol; // these two to set reply address $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $mime_boundary=uniqid('np');$headers .= 'MIME-Version: 1.0'.$eol; $headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol; $msg = "";# Setup for text OR html - $msg .= "--".$mime_boundary.$eol;$htmlalt_mime_boundary = $mime_boundary."_htmlalt"; //we must define a different MIME boundary for this section for the alternative to work properly in all email clients$msg .= "Content-Type: multipart/alternative; boundary=\"".$htmlalt_mime_boundary."\"".$eol;# Text Version$msg .= "--".$htmlalt_mime_boundary.$eol;$msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;$msg .= "Content-Transfer-Encoding: 8bit".$eol;$msg .= "This is a multi-part message in MIME format.".$eol.$eol;# HTML Version$msg .= "--".$htmlalt_mime_boundary.$eol;$msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;$msg .= "Content-Transfer-Encoding: quoted-printable".$eol;$msg .= "This is a <b>multi-part</b> message in <u>MIME</u> format.".$eol.$eol;//close the html/plain text alternate portion$msg .= "--".$htmlalt_mime_boundary."--".$eol.$eol;# Finished$msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection.# SEND THE EMAIL ini_set(sendmail_from,'from@me.com'); // the INI lines are to force the From Address to be used ! mail($emailaddress, $emailsubject, $msg, $headers); ini_restore(sendmail_from); ?> [/code]this is what I am getting in the email it sends[code]--np4519ac68df168_htmlaltContent-Type: text/html; charset=iso-8859-1Content-Transfer-Encoding: quoted-printableThis is a <b>multi-part</b> message in <u>MIME</u> format.--np4519ac68df168_htmlalt--[/code] Quote Link to comment Share on other sites More sharing options...
phporcaffeine Posted September 27, 2006 Share Posted September 27, 2006 Looks like the client isn't reading the headers right.php.net has some good examples of header useage here: http://us2.php.net/manual/en/ref.mail.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.