note 20129 added to function.mail

From: Date: Sat, 23 Mar 2002 03:44:10 +0000
Subject: note 20129 added to function.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-28117@lists.php.net to get a copy of this message
I have found that the "mail" function returns a value of 1 whenever it is successful, and NOTHING when there is in error (in the e-mail address at least). See below: ======================= /* Mail it! */ $mail_val=""; $mail_val=mail("$TO_NAME <$TO_EMAIL>", "$SUBJECT", "$MESSAGE_BODY", "$headers"); echo "Mail Value = $mail_val<P>"; if ($mail_val != 1) { echo "UH, oh... bad e-mail address!"; } ======================= When the e-mail is sent fine, the variable $mail_val will return as "1". When the e-mail doesn't send (in this case I used a name with no @ in it such as "testingemailexample.com"), $mail_val will return as "". -- http://www.php.net/manual/en/function.mail.php http://master.php.net/manage/user-notes.php?action=edit+20129 http://master.php.net/manage/user-notes.php?action=delete+20129 http://master.php.net/manage/user-notes.php?action=reject+20129

« previous php.notes (#28117) next »