Advertisement
Advertisement
| 05.27.2008 at 10:20AM PDT, ID: 23435617 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: |
function SendMessages($an, $ae, $copy, $ss, $company, $rr, $xp, $attach) {
global $headers, $msg;
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\r";
} else {
$eol="\n";
}
$file = "/home/ken/www/NetTrade/files/".$attach;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$name = basename($file);
$now = date("Y/m/d H:i:s");
$headers = "From: $an <$ae>". $eol;
$headers .= "Reply-To: $an <$ae>". $eol;
$headers .= "Return-Path: $an <$ae>". $eol;
if ($rr=="yes") {
$headers .= "Return-Receipt-To: $an <$ae>". $eol;
$headers .= "Disposition-Notification-To: $an <$ae>". $eol;
}
$headers .= "X-Priority: $xp". $eol;
$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=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"".$eol;
$msg = "";
# Text version of the email
$headers .= "--".$mime_boundary.$eol;
$headers .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$msg .= "This is a multi-part message in MIME format.".$eol;
$msg .= "If you are reading this, please update your email-reading-software.".$eol;
$msg .= "You have received an HTML message from $company.".$eol;
$msg .= "If you have any questions regarding this email, please contact $an, $ae".$eol;
# HTML Version of the email
$headers .= "--".$mime_boundary.$eol;
$headers .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$headers .= "Content-Transfer-Encoding: 7bit".$eol;
$msg = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"$ss\">
</head>
<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">
$copy<br><br>
</body>
</html>".$eol;
# Add Attachment to Email
$headers .= "--".$mime_boundary.$eol;
$headers .= "Content-Type: application/pdf; name=\"$attach\"".$eol;
$headers .= "Content-Transfer-Encoding: base64".$eol;
$headers .= "Content-Disposition: attachment".$eol;
$headers .= $content.$eol;
$msg .= $eol.$eol;
# Finished
$msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection.
}
|