Hello all,

I want to send an attachment through php using php mail() function.
But my problem is I can see the attachment in my inbox but the message I have specified in $body variable is not displaying.
Could anyone suggest me what i am doing wrong in the following code?

PHP Code:
$from "email1@gmail.com";
$to "email2@gmail.com";
$subject "Test mail with an attachment";

$file_name "testpage.doc";
$body "This is a test message.This is to show how to send the attachments using simple mail() function.\n\n";
$boundary md5(time());
$headers .= "From:".$from."\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"\n";

$message .= "--".$boundary."\n";
$message .= "Content-Type: application/msword; name=\"".$file_name."\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment; filename=\"".$file_name."\"\n\n";
$message .= "--".$boundary."\n";
$message .= "--".$boundary."\n";
$message .= $body;

if(!
mail($to$subject$message$headers))
    echo 
"Mail Sending Failed";
else
    echo 
"Mail Sent"
Your help will be highly appriciated.
Thanks,