Jump to content

[SOLVED] Mail();


Muncey

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.