I'm rather new to php but as an example, I'm using the below code to send out an attached .avi file through the mail function. However, when the avi arrives as an attachment to the email, it appears the first 57 bytes are gone (ie been stripped), whereas if i use outlook from my own computer and mail it to myself, i get the full avi file. Obviously I'm trying to understand what could be stripping out the first 57 bytes. Down in the code where it does the lines -
$encodedfile = chunk_split(base64_encode($attach));
echo $encodedfile;
echo "<br />";
I do see the echoing of the first 57 chars as they should be so at that point in the code it appears it's ok, the problem is somewhere afterwords during send or maybe even on the receive side from outlook.
Under much pressure here, any clues as to why????
Regards and Thanks
Alan
$boundary = '----'.md5(uniqid(rand())); # Boundary marker value
$mime = "MIME-Version: 1.0\n";
$stest1 = "\tboundary=".'"';
$mime .= 'Content-Type: '."multipart/mixed;\r\n\t";
$mime .= "boundary=".'"';
$mime .= "$boundary";
$mime .= '"';
$mime .= "\r\n"; */
$mime .= "Content-Type: multipart/mixed; ";
$mime .= "boundary=\"$boundary\"\n"; //'."\n\tboundary=\"$boundary\""."\n";
$mime .= "\n\nThis is a multiple part mime message\n\n";
$mime .= "--$boundary\n";
$mime .= 'Content-Type: '."text/plain;\n\tcharset=".'"iso-8859-1"'."\n";
$mime .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$bodystring = "This is body test.";
$mime .= "$bodystring\n";
$mime .= "--$boundary\n";
$mime .= "Content-Type: video/avi;\n\tname=\"$fattachname\"\n";
$mime .= "Content-Transfer-Encoding: base64\n";
$mime .= "Content-Disposition: attachment;\n\tfilename=".'"'."$fattachname".'"'."\n";
// now attachment
if(!($fattach = fopen($fattachname,'rb'))){
$error = "Can't open file";
echo $error;
exit;
}
$attach = fread($fattach,filesize($fattachname));
fclose($fattach);
$encodedfile = chunk_split(base64_encode($attach));
echo $encodedfile;
echo "<br />";
$mime .= $encodedfile;
$mime .= "--$boundary--";
mail($addresses, $esubject, "", $mime);
echo "You're email has been sent...";
$encodedfile = chunk_split(base64_encode($attach));
echo $encodedfile;
echo "<br />";
I do see the echoing of the first 57 chars as they should be so at that point in the code it appears it's ok, the problem is somewhere afterwords during send or maybe even on the receive side from outlook.
Under much pressure here, any clues as to why????
Regards and Thanks
Alan
$boundary = '----'.md5(uniqid(rand())); # Boundary marker value
$mime = "MIME-Version: 1.0\n";
$stest1 = "\tboundary=".'"';
$mime .= 'Content-Type: '."multipart/mixed;\r\n\t";
$mime .= "boundary=".'"';
$mime .= "$boundary";
$mime .= '"';
$mime .= "\r\n"; */
$mime .= "Content-Type: multipart/mixed; ";
$mime .= "boundary=\"$boundary\"\n"; //'."\n\tboundary=\"$boundary\""."\n";
$mime .= "\n\nThis is a multiple part mime message\n\n";
$mime .= "--$boundary\n";
$mime .= 'Content-Type: '."text/plain;\n\tcharset=".'"iso-8859-1"'."\n";
$mime .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$bodystring = "This is body test.";
$mime .= "$bodystring\n";
$mime .= "--$boundary\n";
$mime .= "Content-Type: video/avi;\n\tname=\"$fattachname\"\n";
$mime .= "Content-Transfer-Encoding: base64\n";
$mime .= "Content-Disposition: attachment;\n\tfilename=".'"'."$fattachname".'"'."\n";
// now attachment
if(!($fattach = fopen($fattachname,'rb'))){
$error = "Can't open file";
echo $error;
exit;
}
$attach = fread($fattach,filesize($fattachname));
fclose($fattach);
$encodedfile = chunk_split(base64_encode($attach));
echo $encodedfile;
echo "<br />";
$mime .= $encodedfile;
$mime .= "--$boundary--";
mail($addresses, $esubject, "", $mime);
echo "You're email has been sent...";