Hi Guys, i am trying to send an .pdf file trougth php, everything is ok but when i try to open the attached file it´s corrupt, what i'm doing wrong? attach code bellow ...
// attachments
if($AttmFiles){
foreach($AttmFiles as $AttmFile){
$patharray = explode ("\", $AttmFile); // windows patch
$FileName=$patharray[count($patharray)-1];
$Msg.= "\n--".$OB."\n";
$Msg.="Content-Type: application/pdf;\n\tname=\"".$FileName."\"\n"; // app/octstream result same problem
$Msg.="Content-Transfer-Encoding: base64\n";
$Msg.="Content-Disposition: attachment;\n\tfilename=\"".$FileName."\"\n\n";
//file goes here
$fd=fopen ($AttmFile, "r");
$FileContent=fread($fd,filesize($AttmFile));
fclose ($fd);
$FileContent=chunk_split(base64_encode($FileContent));
$Msg.=$FileContent;
$Msg.="\n\n";
}
}
Please helpme! 😕