note 126740 added to function.mail
| From: | mycplus at NOSPAM dot gmail dot com | Date: | Sun, 02 Jan 2022 20:30:54 +0000 |
| Subject: | note 126740 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217456@lists.php.net to get a copy of this message | ||
Throw the exception if the message was not delivered. It allows you to distinguish and route the
error messages to a specific class for handling.
<?php
function SendEmail($to, $subject, $message, $headers, $params = null) {
if (!@mail($to, $subject, $message, $headers, $params)) {
$error = error_get_last();
$msg = 'Could not send email: ' . (isset($error['message']) ?
$error['message'] : 'unknown');
throw new SocketException($msg);
}
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 206.84.136.54)
----
Manual Page -- https://php.net/manual/en/function.mail.php
Edit -- https://main.php.net/note/edit/126740
Del: integrated -- https://main.php.net/note/delete/126740/integrated
Del: useless -- https://main.php.net/note/delete/126740/useless
Del: bad code -- https://main.php.net/note/delete/126740/bad+code
Del: spam -- https://main.php.net/note/delete/126740/spam
Del: non-english -- https://main.php.net/note/delete/126740/non-english
Del: in docs -- https://main.php.net/note/delete/126740/in+docs
Del: other reasons-- https://main.php.net/note/delete/126740
Reject -- https://main.php.net/note/reject/126740
Search -- https://main.php.net/manage/user-notes.php