note 109655 added to function.mail

From: Date: Mon, 06 Aug 2012 09:07:13 +0000
Subject: note 109655 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-189931@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 212.46.151.2 ---- Manual Page -- http://www.php.net/manual/en/function.mail.php Edit -- https://master.php.net/note/edit/109655 Del: integrated -- https://master.php.net/note/delete/109655/integrated Del: useless -- https://master.php.net/note/delete/109655/useless Del: bad code -- https://master.php.net/note/delete/109655/bad+code Del: spam -- https://master.php.net/note/delete/109655/spam Del: non-english -- https://master.php.net/note/delete/109655/non-english Del: in docs -- https://master.php.net/note/delete/109655/in+docs Del: other reasons-- https://master.php.net/note/delete/109655 Reject -- https://master.php.net/note/reject/109655 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#189931) next »