note 109655 deleted from function.mail by crell
| From: | crell@php.net | Date: | Tue, 12 Apr 2022 01:09:42 +0000 |
| Subject: | note 109655 deleted from function.mail by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218229@lists.php.net to get a copy of this message | ||
Note Submitter: martin dot farrow at versacloud dot com
----
I've noticed that on some versions of PHP occasionally mail() returns the empty string for
success, rather than true or false. The empty string evaluates to false.
if you use constructs like
if ( mail( ... ) ){
# do something here on success
}
this wont work consistently.
so you need code like
$ret=mail(....)
if ( $ret == '' || $ret ){
# do something here
}
to get consistent results.