php mail with attachment dosen,t show message
<pre><code>$to="example@example.com";
            $from = $email;
            $subject = "Registration";
            $message ="This is to inform you that $name is registerd with oursite."."\n"."\n"."\n"."\n"."Name : $name"."\n"."\n"."Mobile :$phone"."\n"."\n"."Email : $email"."\n"."\n"."Position : $position";
            $headers = "From: $from";
            if($resume!="")
            {
                $fileatt = $resume;
                $fileatttype = $filetype;
                $fileattname = $resume;
                // File                 
                $semi_rand = md5(time());
                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
                $headers .= "\nMIME-Version: 1.0\n" .
                "Content-Type: multipart/mixed;\n" .
                " boundary=\"{$mime_boundary}\"";
                $message = "This is a multi-part message in MIME format.\n\n" .
                "-{$mime_boundary}\n" .
                "Content-Type: text/plain; charset=\"iso-8859-1\n" .
                "Content-Transfer-Encoding: 7bit\n\n" .
                $message .= "\n\n";

                $data = chunk_split(base64_encode($data));
                $message .= "--{$mime_boundary}\n" .
                "Content-Type: {$fileatttype};\n" .
                " name=\"{$fileattname}\"\n" .
                "Content-Disposition: attachment;\n" .
                " filename=\"{$fileattname}\"\n" .
                "Content-Transfer-Encoding: base64\n\n" .
                $data . "\n\n" .
                "-{$mime_boundary}-\n";
                // Send the email
            }
            mail($to,$subject,$message,$headers);
</code></pre>

<p>This is my code. It will show the attachment, but not the message("this is to inform you that....").
If there is no file to be attached, it shows the message. Please help me to solve this. I am very new in php.</p>
