hi,
I've made a form to send out emails with attachments, and the attachments
look ok when they arrive but the content is somehow bad. I cannot open gifs
nor can word open the documents. Looking at the content something may be
wrong with the encoding: if i open the GIF file the normal one as well as
the attachment I sent start with GIF89a, but then they start to be different.
I think this is the relevant part of my code:
$atta_type=$_FILES['AttachedFile']['type'];
if
(strpos($atta_type,';')){$atta_type=substr($atta_type,0,strpos($atta_type,';'));}
//for Opera
$atta_tmp_name=$_FILES['AttachedFile']['tmp_name'];
$fp = fopen($atta_tmp_name,"rb");
while (!feof($fp)){$filedata .= addslashes(fread($fp,1200));}
$filedata = chunk_split(base64_encode($filedata));
$attachment = $atta_type."\n\n"
."--$boundary\n"
."Content-Type: $atta_type"."; name = \"$atta_name\"\n"
."Content-Transfer-Encoding: $encoding"
."\n\n$filedata\n\n"
."--$boundary--\n";
Just for fun the headers as well:
'From: "SENSE mailinglist" <[EMAIL PROTECTED]>'
'Subject: '.$subject
'Reply-To: [EMAIL PROTECTED]'
'Return-Receipt-To: [EMAIL PROTECTED]'
'Return-Path: [EMAIL PROTECTED]'
'MIME-Version: 1.0'
'Content-Type: multipart/mixed;
boundary="'.$boundary."\"\n\n");'To: SENSE_List'
"This is a MIME encoded message. \n\n"
."--$boundary\n"
."Content-Type: ".(($IsHTML)?'text/html':'text/plain')."\n"
."Content-Transfer-Encoding: 8bit\n\n"
.$mailbody .$message
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php