MIME types
Posted: Wed Apr 13, 2005 3:59 pm
Hi,
I am trying to attach a jpg image to an email to be sent via php.
My email sends perfectly as does the jpg, only when I open the email once received the jpeg has .dat appended to it.
For example, mypicture.jpg becomes mypicture.jpg.dat
I think it has something to do with the MIME type, here is the code i am using:
Any suggestions would be appreciated. Thanks!
Rob.
I am trying to attach a jpg image to an email to be sent via php.
My email sends perfectly as does the jpg, only when I open the email once received the jpeg has .dat appended to it.
For example, mypicture.jpg becomes mypicture.jpg.dat
I think it has something to do with the MIME type, here is the code i am using:
Code: Select all
$filename="1.jpg";
$attach_file=fopen($filename,"r");
$contents=fread($attach_file,filesize($filename));
fclose($attach_file);
$part2["type"]=TYPEAPPLICATION;
$part2["encoding"]=ENCBINARY;
$part2["subtype"]="octet-stream";
$part2["description"]=basename($filename);
$part2["contents.data"]=$contents;Rob.