Monday, 28 November 2016

php - How can I get the error message for the mail() function?

I've been using the PHP mail() function.



If the mail doesn't send for any reason, I'd like to echo the error message. How would I do that?



Something like



$this_mail = mail('example@example.com', 'My Subject', $message);

if($this_mail) echo 'sent!';
else echo error_message;


Thanks!

No comments:

Post a Comment