Skip to content

Instantly share code, notes, and snippets.

@miwebguy
Created April 25, 2014 16:18
Show Gist options
  • Select an option

  • Save miwebguy/11295023 to your computer and use it in GitHub Desktop.

Select an option

Save miwebguy/11295023 to your computer and use it in GitHub Desktop.
MultiPartEmail
<?php
function SendNews($to,$subject,$emailText,$emailHtml) {
global $fromName,$fromEmail,$MoPixList;
//TEXT FORMAT
//Plain Text Boundary of Email Message for Non-HTML browsers
$message="
--==Multipart_Boundary_xc75j85x
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
";
$message.=$emailText;
//HTML FORMAT
//HTML Email Boundary
$message.="
--==Multipart_Boundary_xc75j85x
Content-Type: text/html; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit
";
//End of HTML Multipart Boundary
$message.=$emailHtml . "
--==Multipart_Boundary_xc75j85x--";
//Email Mime-Type for text/HTML email
$header.="From: $fromName < $fromEmail >\n\r";
//$header.="Bcc: " . $MoPixList . "\n\r";
$header.='MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="==Multipart_Boundary_xc75j85x"';
//mail ('anyone@grwebguy.net',$subject,$message, $header);
mail ($to, $subject,$message, $header);
echo $emailHtml;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment