hi can any one help out for single attachment i.e getting error while viewing the attachment i outlook " file cannot be opened becoause it's an unsupported file type or has been damaged".


$headers .= "Reply-To: ".$from_name." <".$from_address.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed;boundary=\"".$mime_boundary."\""."\r";

# File for Attachment
$my_path = $_SERVER['DOCUMENT_ROOT']."/InstructionsPDF/";
$file= $_SERVER['DOCUMENT_ROOT']."/InstructionsPDF/".$AttachmentName; // use relative path OR ELSE big headaches. $letter is my file for attaching.

# Attachment
$message .= "--".$mime_boundary."\r\n";
$message .= "Content-Type: application/pdf; name=\"".$AttachmentName."\""."\r"; // sometimes i have to send MS Word, use 'msword' instead of 'pdf'
$message .= "Content-Transfer-Encoding: base64"."\r";
$message .= "Content-Length: ".filesize($file)."\r";
$message .= "Content-Disposition: attachment"."\r"."\r";

//$content = file_get_contents($file);
$handle=fopen($file, 'r');
$message.= chunk_split(base64_encode($f_contents),"50");
$message .= "\r\n\r\n";
$message .= "--".$mime_boundary."--\r\n\r\n";