View Full Version : problem in attaching the file to mail

06-27-2008, 02:21 PM
Hello friends,
i want to send the mail by using mail function but mail is working and all the data is receiving
,if i attached the file means attaching after sending file name will beas "noname" with 0kb but i can download it please help me

if($filetype=="application/octet-stream" or $filetype=="text/plain" or $filetype=="application/msword")
$message= '
<table cellspacing="0" cellpadding="8" border="0" width="400">
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;"><strong>Name</strong></td>
<td style="font-family:Verdana, Arial; font-size:11px; color:#333333;">'.$strname.'</td>
</tr> </table>';

$subject = "Mail with doc file attachment";
//$fp = fopen($strresume, "rb");
// $file = fread($fp, $strresume_size);

// $file = chunk_split(base64_encode($file));

$filename= fopen($filetemp,'rb');
$num = md5(time());
$headers = "From: Name<name@name.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=".$num."\r\n";
$headers .= "--$num\r\n";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "".$message."\n";
$headers .= "--".$num."\n";
$headers .= "Content-Type:".$strresume_type." ";
$headers .= "name=\"".$strresume_name."\"r\n";
$headers .= "Content-Transfer-Encoding: base64\r\n";
$headers .= "Content-Disposition: attachment; ";
$headers .= "filename=\"".$strresume_name."\"\r\n\n";
$headers .= "".$file."\r\n";
$headers .= "--".$num."--";
$dd = mail($to, $subject, $message, $headers);

echo "sent";
echo "failed";