Here is my PHP code fragment. I would provide more code if Necessary.
if (mail($to, $subject, $message, $header)) {
echo 'I can send the mail!';
return true;
}
The body of $message
is like this. In case that can be the problem:
$email = $_POST['email'];
$email = $connection->real_escape_string($email);
$to = $email;
$subject = "Reset your password";
$header = "from: Site <contact@demosite.com>";
$message = "Hi, ".$username."! You or someone else used this email address to reset password for Site. If you did not do it ignore the message.\n";
$message .= "To reset your password please click on the link below\n";
$url = 'http://demosite.com/reset.php?rkey=' . $rkey . '';
$message .= $url;
Both the register and reset function have similar text except for the fact that registered uses $code
instead of $rkey
.
I can echo I can send the mail
so the function returns true. Why am I still unable to receive any emails. Are there some other reasons that could cause this?
This is not related to window 8, I can't send the mail from my hosting provider and they use Linux. Could anyone remove the duplicate tag?