note 70923 deleted from function.mail by nlopess

From: Date: Sat, 04 Nov 2006 10:59:50 +0000
Subject: note 70923 deleted from function.mail by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-119389@lists.php.net to get a copy of this message
Note Submitter: JeffreyJarnot at COMCAST dot net ---- I did not see to many items for error checking the mailoutput. This seems to work just fine for me. I tested via a change in the SMTP addt to a bogus one. IT used the TRY CATCH JJ $to = 'somebody@php.net'; $subject = 'User Support Request ' ; $message = $sometextbox; $went = 'The email was sent '; $notwent = 'The email DID NOT SEND. Please call your helpdesk for assistance'; try { mail($to, $subject, $message); } catch (Exception $e) { echo 'Sorry email sent failed. Pleae call the help desk'; echo 'Exception ' . $e->getcode() . ': ' . $e->getMessage() . '<br />'; } if (isset($e)) { echo $notwent ;} else{ echo '<strong><font color="#CC0000">' . $went . 'at ' . date("n/j/Y - g:i:s") .'</font></strong>'; } }

« previous php.notes (#119389) next »