Muncey Posted July 10, 2007 Share Posted July 10, 2007 Im having some trouble, i've been making a register form and login form and everything is working fine so i decided to add in another feature, confirm email. I did this by making a md5 random number as the confirm code and added it to the database when the person registers, aswell i sent an email linking to confirm.php?confirm=$confirm_key. So when they click the link i simply get the confirm key from the url and then match it to the person in the database... everything works, ive checked the confim links ect and it moves all the data over perfectly from one table to another... im just having a problem with getting it to send the actual email. Everytime i register it doesn't send the email, yet everything in teh database gets added and i can still confirm it using the appropriate url, i just can't get it to send the email. Heres the code: *** here is where the info gets added to the database *** if($query){ echo "Thank you $username for registering."; $to = $email; $subject = "Your confirmation link here"; $header = "from: Dave <email>"; $message = "Your Comfirmation link \r\n"; $message.= "Click on this link to activate your account \r\n"; $message.= "http://www.myurl.com/confirm.php?passkey=$confirm_code"; }else{ echo "Your registration failed, please try again."; } if(mail($to, $subject, $message, $header)){ *** here is where it says if the email sent or not *** now the funny thing is... it says the email sent. in the last if statement it echos that the email was sent correctly. Anybody know whats going on? Everything else in the script is working Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/ Share on other sites More sharing options...
clanstyles Posted July 10, 2007 Share Posted July 10, 2007 Make sure $to is equal to something before all that and make sure its not being filtered out by the spam filters or what ever. If you don't have enough header information required it is automatilcy filtered out. Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/#findComment-294516 Share on other sites More sharing options...
wildteen88 Posted July 10, 2007 Share Posted July 10, 2007 Has mail been setup in the php.ini to use an SMTP server. Also mail only checks that the headers are ok. It doesn't check whether the email has been sent or received or not. Another thing to check is your spam/junk (in)box(es). Alot of the time PHP emails get sent to spam/junk. Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/#findComment-294517 Share on other sites More sharing options...
Muncey Posted July 10, 2007 Author Share Posted July 10, 2007 Thanks i've checked my spam and nothing. Also $to = $_POST['email']; which if was empty it wouldn't have got that far in the script because i make it check that $_POST['email'] isn't null and i do more tests on it too. I'll check the php.ini now... I checked the phpinfo and i got: sendmail_from no value sendmail_path no value I have no idea what to do or what this means lol. Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/#findComment-294529 Share on other sites More sharing options...
Muncey Posted July 10, 2007 Author Share Posted July 10, 2007 Contacted my host about this they told me that i cannot edit the phpini file but the file is configured to allow php emails.. i cannot find any other reason why it's not sending and my host are complete ... you know what i mean. Also i have vBulletin which also sends validation emails and that works fine.. so is there another way i can do this? A fairly simple way would be nice lol. Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/#findComment-294676 Share on other sites More sharing options...
Muncey Posted July 10, 2007 Author Share Posted July 10, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/59292-solved-mail/#findComment-294799 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.