As the subject line says, we recently discovered that on our server, the mail function is returning false, even though the email is successfully getting sent through. This is a new problem; I am sure it used to work correctly. We haven't changed the mail settings in a very long time. We did upgrade from PHP4.3.? to 4.4.2 sometime over the last few months (though we did not notice this error for a while after we did that). But I don't think upgrading to a newer version of PHP4 should affect the way the mail function interacts with the SMTP server; the only thing I can think of that could have happened is that a setting got changed, or something got corrupted, or something. But we checked our settings, tried the mail function with various versions of a From field - as well as with none at all specified - in the additional parameters field, and generally tried whatever we could think of, and have no idea what's causing this or how to fix it. There are no errors or warnings.
I understand that the result of the mail function is not necessarily going to tell you whether or not the email was successfully sent. But I don't quite understand how it could return false and yet the email will still go through. Really, what I'm trying to figure out is, what exactly is the return value of the mail function based on? I was under the impression that a result of false means that the mail server wouldn't accept the email, in which case I don't understand how it can still get sent to the recipient.
Wording of PHP.net:
Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise
Can anyone explain to me:
1. What is the return value of the mail function based on?
2. (Based on the answer to #1) How is it that an email get sent through even when the function has returned false?
I ask because I am assuming this is an issue with the SMTP server and/or its communication with PHP. But maybe it's not (what are your guesses?). Meanwhile, I have no idea what to check to get to the bottom of this. Neither does my sysadmin- he claims everything looks fine. All help, suggestions, etc. would be greatly appreciated. Thanks guys.
mail function returns false but sends email anyway
Moderator: General Moderators