This is what I found online
$headers = “MIME-Version: 1.0\r\n”;
$headers .= “To: <“.$to_email.”>\r\n”;
$headers .= “From: “.$from_name.” <“.$from_email.”>”;
$random_hash = md5(date(‘r’, time()));
// add boundary string and mime type specification
$headers .= “\r\nContent-Type: multipart/mixed; boundary=\”PHP-mixed-“.$random_hash.”\””;
// read the atachment file contents from a string previously formed,
// encode it with MIME base64,
// and split it into smaller chunks
$attachment = chunk_split(base64_encode($content));
// construct the body of the message
$message = “–PHP-mixed-“.$random_hash;
// my attachment was an html file
$message .= “\r\nContent-Type: text/html; name=\””.$filename.”\””;
$message .= “\r\nContent-Transfer-Encoding: base64”;
$message .= “\r\nContent-Disposition: attachment\r\n”.$attachment.”\r\n”;
$message .= “\r\n–PHP-mixed-“.$random_hash.”–“;
// Windows
ini_set(‘sendmail_from’, $return_email);
mail($to_email, addslashes($subject), $message, $headers);
ini_restore(‘sendmail_from’);
// Linux
// mail($to_email, addslashes($subject), $message, $headers, “-r “.$return_email);