It's not a problem with the base64 encoding. When sending messages of this nature you have to create a certain set of headers. I am sorry i cannot remembers the exact RFC numbers involved (there are several) by 822 is a good place to start i think.
Or if you like short cuts, you can send yourself the same file using your normal mail client, look at the headers and try to reproduce them with your php script.
Oleg Borzenkov wrote:
Hi, All! I have a problem with sending binary attachment with mail() function. To do so I use standart scheme: chunk_split(base64_encode(fread($f,filesize($filename)))). The system is FreeBSD4.7, Apache2, PHP 4.3.4 When the attachment is plain text file , it passes well. By when I use excell, zip and so on, the attachment is corrupted. I tried various scripts which I found in the internet, so I don't think that the problem is in my code. It's looks like the base64_code() function makes something wrong. Or something wrong is in my system tunes. Maybe php.ini. I sow in various forums questions like this one. But there was no answers on them. Please , explain me what I do wrong . Thank you.
-- Raditha Dissanayake. ------------------------------------------------------------------------ http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php