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".
Code
$headers .= “Reply-To: “.$from_name.” <”.$from_address.“>
“;
$headers .= “MIME-Version: 1.0
“;
$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\
“;
$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');
$f_contents=fread($handle,filesize($file));
$message.= chunk_split(base64_encode($f_contents),"50");
$message .= "\\r\
\r
“;
$message .= “–”.$mime_boundary.”–\r
\r
";