Why is my email function truncating my attachments?
Posted: Mon May 15, 2006 3:20 pm
I am attempting to email a text file comprised of a list of variables separated by commas. However, the version of the file that is attached to my email has had the begging of the list erased.
For example, a file that contained:If anyone could help, I would be very grateful!
For example, a file that contained:
resulted in an attachment equal to:customer number, email@email.com, reference information, 11 x 14, New York"," NY, 23/12/2006, Metro
Here is my code:11 x 14, New York"," NY, 23/12/2006, Metro
Code: Select all
$fp = fopen($file,"r");
$fcontent = fread($fp ,filesize($file));
fclose($fp);
$content = chunk_split(base64_encode($fcontent));
$boundary = strtoupper(md5(uniqid()));
$name = basename($file);
$header = "From: $from\nReply-To: $from\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=$boundary\r\n";
$body .= "--$boundary\r\n";
$body .= "Content-Type: text/plain\r\n";
$body .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$body .= "$msgtext\r\n\r\n";
$body .= "--$boundary\r\n";
$body .= "Content-Type: text/plain; name=\"$file\"\r\n";
$body .= "Content-Transfer-Encoding: base64\r\n";
$body .= "Content-Disposition: attachment; filename=
\"partner.txt
\"\r\n";
$body .= "$content\r\n";
$body .= "--$boundary--";