runnerjp Posted November 16, 2008 Share Posted November 16, 2008 ok i have my code below that checks to see if a user wants to recive emails about new posts on a topic... <?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"; } } //set emailed to 'y' so that they don't get numerous emails... set it back to 'n' when they view this topic $query_noted = "UPDATE forum_email SET mailed='0' WHERE topic_id = '".$forumtopicid."'";?> but my emails are not been sent and $query_noted is'nt updating the mailed field... 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 Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/ Share on other sites More sharing options...
JasonLewis Posted November 16, 2008 Share Posted November 16, 2008 I can tell you it's not updating because you're not actually running mysql_query() on $query_noted. Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691247 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 doh that might help.. forgot to add that... prob cos im more frustrated that i cant get the emails to send lol Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691248 Share on other sites More sharing options...
JasonLewis Posted November 16, 2008 Share Posted November 16, 2008 Haha, yeah. Hm, about the emails. Your $from variable, I would make sure that it has "From: {email here}". Since it's a header I think that it's required to have the "From:" part. Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691254 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 changed ti to <?php $query = "SELECT fe.*, u.email, u.ID FROM forum_email as fe INNER JOIN users as u ON u.ID = fe.user_id"; $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 = 'admin@runningprofiles.com'; $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"; } }?> didnt work sadly Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691259 Share on other sites More sharing options...
JasonLewis Posted November 16, 2008 Share Posted November 16, 2008 No, I meant like this: $from = "From: admin@runningprofiles.com"; If you look at the mail() function in the manual it gives an example of using the headers. Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691261 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 nope adly that didnt work either... its wierd as ud thought that it would echo MAIL FAILED FOR $email ... Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691267 Share on other sites More sharing options...
JasonLewis Posted November 16, 2008 Share Posted November 16, 2008 As the manual states: It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. Sorry, but I really don't know. Perhaps the e-mail is wrong. Perhaps you should wait a bit longer. Check your junk. Try a different e-mail address. ??? Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691269 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 Perhaps the e-mail is wrong. -- thought that at 1st and its correct Perhaps you should wait a bit longer. -- i did it yesterday lol Check your junk.-- empty Try a different e-mail address. /-- yup done and no success lol thanks for trying.... any1 else know? Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691274 Share on other sites More sharing options...
runnerjp Posted November 16, 2008 Author Share Posted November 16, 2008 humm ok it was my host's fault ... summat to do with error in my email inbox lol Quote Link to comment https://forums.phpfreaks.com/topic/132928-solved-emails-arnt-sending/#findComment-691282 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.