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 = 'testmail@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: sender@gmail.com' . "
" .
'Reply-To: sender@gmail.com' . "
" .
'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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…