For some reason, my PHP mail is not sending.
This is my script:
$tom = $email;
$subjm = 'Company: Forgotten password';
$msgm = "-- DO NOT REPLY TO THIS EMAIL --\nHi,\nYou have forgotten your password.\nHereby we want to supply a you a new one.\nNew password: $pass";
$msgm = wordwrap($msgm, 70);
$mail_sent = @mail($tom, $subjm, $msgm);
echo "$tom <br /> $subjm <br /> $msgm";
echo $mail_sent ? "Mail sent" : "Mail failed";
echo "<br />Your new password has been sent to the email you've signed up with.<br />If you can't find the email, please wait a few minutes or check your spam box.";
However, it always gives me "Mail failed", and I do not see it in mailbox. I've checked if the correct emailadress was being produced by my script ($email), and it was. So I'm kinda lost as to why it will not send.
mailuses server's inbuilt mailing service, sendmail usually. If you're sending emails from your local testing machine and if it's on Windows - then you need to set up mail server first.fromaddress as well; see the manual entry for an example / how to send additional headers: php.net/manual/en/function.mail.php@beforemail. Remove the@and try again so you can actually get an error.