Samir Ghobril
Samir Ghobril

Reputation: 5229

Verification e-mail not sent

Hey, I have set up the piece of code below to send a verification e-mail to the subscriber. But it doesn't seem to reach them(Testing it on my own) I'm using http://localhost/ to test the site, don't know if that's the problem. Also I'm receiving the message that the verification e-mail has been sent so it should be sent. Here's the code:

if(mysql_query("insert into users(username,password,email,fname,lname,hash) values('$username','$password','$email','$fname','$lname','$hash')")or die (mysql_error ())){
 echo "Welcome, You have successfully signed up. Please check the verification e-mail sent to you.";
 $to = $email; 
   $subject = 'Signup | Verification'; 
   $message = ' 

     Thanks for signing up! 
      Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. 

      ------------------------ 
      Username: '.$username.' 
     Password: '.$password.' 
     ------------------------ 

     Please click this link to activate your account: 

     http://www.JMtoday.com/verify.php?email='.$email.'&hash='.$hash.' 

   ';

    $headers = 'From:[email protected]' . "\r\n";  
    mail($to, $subject, $message, $headers); 
 }

Upvotes: 1

Views: 241

Answers (1)

Greg
Greg

Reputation: 21909

Unless you have a mail server running on localhost too, the mail function won't know where to send the email.

Upvotes: 2

Related Questions