Some days ago when using
mail() I had it working.
But now it doesn't work. And I don't know what the problem is.
$to = 'firstname.lastname@example.org'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: email@example.com' . "rn" . 'Reply-To: firstname.lastname@example.org' . "rn" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); $mail_sent = @mail( $to, $subject, $message, $headers ); echo $mail_sent ? "Mail sent" : "Mail failed";
It displays "Mail sent".
I haven't touched anything in Apache or this code. I have tested the code in an empty PHP file with the same result. How can I debug this problem?
Could it be that E-Mails are being sent fine, but are caught by a spam filter? If this could be, allow me to cross-post myself:
A few bullet points (Assuming that mail() returns true and there are no errors in the error log) :
For german speakers, I have written a quite exhaustive "what to do" on this issue some time ago. See here.