emails aint sending

ok i have my code below that checks to see if a user wants to recive emails about new posts on a topic...
but my emails are not been sent

i var_dunm($row) and got

 array(5) { ["user_id"]=>  string(1) "1" ["topic_id"]=>  string(3) "484" ["mailed"]=>  string(1) "1" ["email"]=>  string(25) "admin@runningprofiles.com" ["ID"]=>  string(1) "1" }

so its getting the data ... any 1 figure out why the emails aint been sent to me
<?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id WHERE fe.topic_id = " . $forumpostid . "  AND fe.mailed=1";
$res = mysql_query($query) or die ("$query fails : ".mysql_error());
//$row = mysql_fetch_assoc($res);
//var_dump($row);
//echo $forumpostid; echo $id;
//nobody wants an email, stop now
if(mysql_num_rows($res)==0)
{
 echo "no records returned";
        exit;
}
 
// ADDED CODE TO SEND EMAIL MESSAGES
$subj = 'Forum Updated';
$from = ' [your return information ] ';
$text = ' [your message text] ';
 
while ($row = mysql_fetch_assoc($res)) {
        extract ($row);
        if (!mail($email, $subj, $text, $from)) {
                echo "<br />MAIL FAILED FOR $email \n";
        }
}

Open in new window

runnerjpAsked:
Who is Participating?
 
Ray PaseurConnect With a Mentor Commented:
@runerjp: Isn't this what we are talking about in another thread? ~Ray

Try changing the mail command to OMIT the from field, like this on line 20.
        if (!mail($email, $subj, $text)) {

Open in new window

0
 
Roger BaklundCommented:
What is in the $from variable? This is used as mail headers, and must be formatted correctly.

http://php.net/manual/en/function.mail.php
0
 
Ray PaseurCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.