note 20129 deleted from function.mail by victor

From: Date: Thu, 05 Sep 2002 18:27:18 +0000
Subject: note 20129 deleted from function.mail by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-36180@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 "".

« previous php.notes (#36180) next »