I have an issue that no one has yet to resolve.
On my website, during registration config, a verification code is sent via mail to the user's email address.
Everything besides the mail()
function is working properly.
Here is my entire PHP registration code:
$code = md5(uniqid($safe_email,true));
$email = $_POST['email'];
$he_email = htmlentities($email);
$safe_email = mysql_real_escape_string($he_email);
if(isset($r_submit))
{
//SQL
$email_query = "SELECT email FROM users WHERE email = '$safe_email'";
$email_queried = mysql_query($email_query);
$email_count = mysql_num_rows($email_queried);
//VALIDATION
$errors = array();
if( empty($safe_fname) || empty($safe_lname) || empty($safe_email) || empty($safe_email_again) || empty($safe_password) )
{ $errors = '<p>One or more fields left empty'; }
elseif( strlen($safe_password) < 6){ $errors = '<p>Password must be atleast 6 charcters long.</p>'; }
elseif ( !preg_match('/@/',$safe_email) || !preg_match('/@/',$safe_email_again) ) {$errors = '<p>Invalid E-mail</p>';}
elseif($safe_email != $safe_email_again){ $errors = '<p>E-mails do not match.</p>'; }
elseif($email_count != 0){ $errors = '<p>E-mail already in use.</p>'; }
//Inserting new data in database
else{ $sql1 = "INSERT INTO users (fname, lname, full_name, veri_id, email, password )
VALUES ('$safe_fname','$safe_lname','$full_name', '$code', '$safe_email', '$hash_password')";
$sql2 = mysql_query($sql1);
//The mail function that isn't working
$msg = "Verify Link => http://www.nljobmarket.com/verify.php?code=$code";
mail($safe_email,'Welcome',$msg);
header('Location: ../just_registered.php');
}
}
As you can see, appropriate parameters are being passed through the mail()
function, but the e-mail is not being sent (I have tried with 3 different e-mail accounts)
- I have also contacted my web hosting to ensure it wasn't an issue on their end.
My question is: Why isn't the e-mail containing the verification code being received by the user?
NOTE:: The database queries just before the mail()
function are working fine.
EDIT: Headers make no difference lol.....