dlindsey Posted September 3, 2009 Share Posted September 3, 2009 No idea why this isn't sending any emails. Can someone help me out? $username = mysql_real_escape_string($_POST['user_name']); $md5pass = md5(mysql_real_escape_string($_POST['password'])); //Contact Info $fname = mysql_real_escape_string(strip($_POST['first_name'])); $lname = mysql_real_escape_string(strip($_POST['last_name'])); $result = mysql_query($sql, $cn) or header( 'Location: http://www.website.com/error.php?msg=registerfail' ); $get_id = mysql_query("select id from table where email='".$email."' and date_joined=".$date_joined, $cn); while($get = mysql_fetch_row($get_id)){ foreach($get as $g_id){ $id = $g_id; } } if($result){ $headers = "From: noreply@website.com" . "\n" . "Reply-To: support@website.com" . "\n" . "X-Mailer: PHP/" . phpversion() ."\n". "X-Priority: 1 (Higuest)\n"; $message = "Thanks for registering with Website, ".$fname." ".$lname. ".\n\nBefore you can login, you must verify your account by clicking on the following link:\n". "http://www.website.com/verify.php?ver=".$verify_key."&id=".$id."\n\n\nwww.website.com"; $mail_success = mail($email, "Thank you for registering at Website", $message, $headers); if(!$mail_success){ header( 'Location: http://www.website.com/error.php?msg=emailfail' ); } header( 'Location: http://www.website.com/login.php' ); exit(); } else{ header( 'Location: http://www.website.com/error.php?msg=emailfail' ); exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/ Share on other sites More sharing options...
mikesta707 Posted September 3, 2009 Share Posted September 3, 2009 whats happening when you run this? does the error message pop up? btw this line "X-Priority: 1 (Higuest)\n"; what I'd assume is the word highest is spelled wrong. IDK if that would screw things up but you probably want to have that spelled right Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911859 Share on other sites More sharing options...
dlindsey Posted September 3, 2009 Author Share Posted September 3, 2009 Thanks for the quick reply. Didn't notice the misspell, but that didn't change anything. It is redirecting to the login page, so php is not seeing any errors in the code. But I am still not getting any emails from the script. Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911862 Share on other sites More sharing options...
mikesta707 Posted September 3, 2009 Share Posted September 3, 2009 well if the mail function didn't run false, than it is indeed sending the mail. Perhaps check your spam folder, or double check the send to address to make sure everything's value is as expected However, I do not see anywhere in that code where you set the $email variable Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911867 Share on other sites More sharing options...
dlindsey Posted September 3, 2009 Author Share Posted September 3, 2009 That's just it, the email is being sent, but not received. $email is being initialized, sorry, forgot to copy that line in. Everything is being added to the database correctly, email is fine. It is just not being received by any addresses. Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911872 Share on other sites More sharing options...
mikesta707 Posted September 3, 2009 Share Posted September 3, 2009 hmmm thats weird.. Try talking to the admins that run your server or something. Maybe you were blacklisted from every mail site ever, though I don't see that as being probable... Try sending a simple plain text email. or delete some of the headers. I'm pretty much at a loss at this point. Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911882 Share on other sites More sharing options...
dlindsey Posted September 3, 2009 Author Share Posted September 3, 2009 Plain text emails aren't working either. $mail_success = mail("myemail@yahoo.com", "Thank you for registering at Website", "test"); Not even this bit of code works... Edit: Ahh...sorry folks, looks like the problem lies with the server host. They are having problems with one of their mail servers so no mail is going through right now. Sorry for wasting your time. Go ahead and delete this if you want. Quote Link to comment https://forums.phpfreaks.com/topic/173015-need-some-help-with-mail-function/#findComment-911966 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.