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?
A:
There's surely going to be a better answer than this, but I'd be interested in hearing it too. Perhaps one solution is to write your own version of the mail() function. Its not toooo hard. And if you really need full/detailed info on why sending of the message failed then it might not be a bad idea. It'll certainly give you more control.
David Archer
2009-07-16 00:30:57
On a shared hosted environment I doubt I'll be able to load an external PHP module. But the main problem is that I really, really have more important issues to address first :)
Remus Rusanu
2009-07-16 00:36:11
+1
A:
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.
TML
2009-07-16 09:18:51