Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get extra error information from PHP's mail() failure?

When mail() fails, there not much info about what went wrong. I understand that the best course of action is to check your sendmail logs, or whatever mailer has PHP used. But from a programming and pragmatic, point of view: on a Linux hosted environment, what can a PHP program do to get as much extra info to properly log the failure, probable cause etc and produce an usable, actionable error?

like image 235
Remus Rusanu Avatar asked Nov 05 '22 20:11

Remus Rusanu


1 Answers

The problem is that, on a Unix-like system, PHP just hands the entire thing to a command-line utility that really only gives PHP the ability to say 'yay' or 'nay'. To do what you want, you'd want to use something like PEAR's Net_SMTP, which can actually communicate intelligently with the mail server.

like image 139
TML Avatar answered Nov 12 '22 15:11

TML