emails aint sending

Posted on 2008-11-16
Last Modified: 2013-12-13
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) "" ["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.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);


//echo $forumpostid; echo $id;

//nobody wants an email, stop now



 echo "no records returned";





$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

Question by:runnerjp
    LVL 39

    Expert Comment

    by:Roger Baklund
    What is in the $from variable? This is used as mail headers, and must be formatted correctly.
    LVL 107

    Accepted Solution

    @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

    LVL 107

    Expert Comment

    by:Ray Paseur

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now