Email says it is from nobody
<p>I have recently tried to use the php mail function to send out confirmation emails and I have been successful in doing so. However, when I added a few things to my script, something doesn't seem to work.   </p>

<p>The code below is the code that I got to work. Everything that I need for the email to contain appears.</p>

<pre><code>$to        = 'Myemail';
$subject = 'Confirmation';
$message = 'This is a test';
$headers = 'MIME-Version: 1.0' . "\r\n" .
    'Content-type: text/plain; charset=iso-8859-1' . "\r\n" .
    'Content-Transfer_Encoding: 7bit' . "\r\n\r\n" .
    'From: fromemail'."\r\n" .  
    'Reply-To: replyemail' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
</code></pre>

<p>However, when I transfer the same headers to another script (Below), the mail delivers but there are a few issues.</p>

<p>1) My mail says that the mail is from nobody.
2) Instead of the headers appearing in the info area, it appears as text in the mail
From: from email
Reply-To: reply email 
X-Mailer: PHP/5.2.9</p>

<p>The script below is being included in another program i wrote, so i am wondering if that is the problem. I don't think its syntax because its the same headers I used above.  I have attached a picture of the mail I get. <a href="http://imgur.com/weNkr" rel="nofollow">http://imgur.com/weNkr</a> </p>

<p>Your help is greatly appreciated!!!</p>

<pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
&lt;html&gt;
    &lt;HEAD&gt;
    &lt;/HEAD&gt;
    &lt;body&gt;
        &lt;?php
        $message = $_POST['message'];
        $subject = $_POST['subject'];
        if ($message != null) {
            include("connect.php");
            $extract = mysql_query("SELECT * FROM `contact` ORDER BY `id`") or die("Error");
            $counter = 0;
            while ($row = mysql_fetch_assoc($extract)) {
                $email[$counter] = $row['email'];
                $counter++;
            }
            for ($x = 0; $x &lt; $counter; $x++) {
                $to = $email[$x];
                $subject = $subject;
                $message = $message;
                $headers = 'MIME-Version: 1.0' . "\r\n" .
                        'Content-type: text/plain; charset=iso-8859-1' . "\r\n" .
                        'Content-Transfer_Encoding: 7bit' . "\r\n\r\n" .
                        'From: fromemail' . "\r\n" .
                        'Reply-To: replyemail' . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();
                mail($to, $subject, $message, $headers);
                echo "EMAIL WAS SENT TO: ";
                echo $email[$x];
                echo "&lt;BR&gt;";
            }
        }
        ?&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
