| This source code describes how to send email with php with headers
<?php
function sendmsg($to,$subject,$text,$from,$file,$type) {
$content = fread(fopen($file,"r"),filesize($file));
$content = chunk_split(base64_encode($content));
$uid = strtoupper(md5(uniqid(time())));
$name = basename($file);
$header = "From: $from Reply-To: $from ";
$header .= "MIME-Version: 1.0 ";
$header .= "Content-Type: multipart/mixed; boundary=$uid ";
$header .= "--$uid ";
$header .= "Content-Type: text/plain ";
$header .= "Content-Transfer-Encoding: 8bit ";
$header .= "$text ";
$header .= "--$uid ";
$header .= "Content-Type: $type; name="$name" ";
$header .= "Content-Transfer-Encoding: base64 ";
$header .= "Content-Disposition: attachment; filename="$name" ";
$header .= "$content ";
$header .= "--$uid--";
mail($to,$subject,"",$header);
return true;
}
?>
|