php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21165 Improve mail() error handling
Submitted: 2002-12-23 05:42 UTC Modified: 2017-10-23 01:13 UTC
Votes:5
Avg. Score:3.8 ± 1.5
Reproduced:4 of 5 (80.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: tit dot petric at telemach dot net Assigned:
Status: Analyzed Package: Mail related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-12-23 05:42 UTC] tit dot petric at telemach dot net
mail is probably the most common used function with the worst set of error reporting available to it

mail() returns true on success and false on error, but this "false" is all you can get with php, when as you have to examine the mailer logs to see if the message acctually failed (i for example get false on the mail() function, but the email is queued and sent with sendmail)

there should be atleast somekind of trigger_error() sequence which would spew out a few E_NOTICE or E_WARNING triggers depending on the progress of mail() - for example.. if the sendmail_path directive isn't configured properly, some incorrect data (any of the parameters beeing null, empty or not set), or you cant connect to the mail server (windows - only guessing that it doesnt report that), or whatever kind of message the mailer spews out resulting in true/false

any kind of verbosity, even if only trough E_NOTICE or E_WARNING would really be appreciated, a simple true or false is just not enough when tracking down why mail() returns false.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 17:48 UTC] jani@php.net
-Summary: mail() is not descriptive enough +Summary: Improve mail() error handling -Package: Feature/Change Request +Package: Mail related -Operating System: all +Operating System: * -PHP Version: 4.3.0RC4 +PHP Version: *
 [2017-10-23 01:13 UTC] kalle@php.net
-Status: Open +Status: Analyzed
 [2017-10-23 01:13 UTC] kalle@php.net
I think this for one, could be handy or at least to improve mail() in general to not only include more detailed errors but also a proper API for things like attachments
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC