diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-08-26 08:00:49 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-08-26 08:00:49 +0000 |
commit | 7531f956aa542558d601a3d4f3039f4041793ec0 (patch) | |
tree | ff74cc499d577b04f8cb3bcaa2b7589d634b02aa /includes/mail.inc | |
parent | 5e73b66f3a00d42567b8d6b35ee821788428dc75 (diff) | |
download | brdo-7531f956aa542558d601a3d4f3039f4041793ec0.tar.gz brdo-7531f956aa542558d601a3d4f3039f4041793ec0.tar.bz2 |
- Patch #169627 by JirkaRybka: improved logging of mail problems.
Diffstat (limited to 'includes/mail.inc')
-rw-r--r-- | includes/mail.inc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/includes/mail.inc b/includes/mail.inc index 06714fe21..ad123fee8 100644 --- a/includes/mail.inc +++ b/includes/mail.inc @@ -76,7 +76,9 @@ * @return * The $message array structure containing all details of the * message. If already sent ($send = TRUE), then the 'result' element - * will contain the success indicator of the e-mail. + * will contain the success indicator of the e-mail, failure being already + * written to the watchdog. (Success means nothing more than the message being + * accepted at php-level, which still doesn't guarantee it to be delivered.) */ function drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) { $default_from = variable_get('site_mail', ini_get('sendmail_from')); @@ -126,6 +128,12 @@ function drupal_mail($module, $key, $to, $language, $params = array(), $from = N // Optionally send e-mail. if ($send) { $message['result'] = drupal_mail_send($message); + + // Log errors + if (!$message['result']) { + watchdog('mail', 'Error sending e-mail (from %from to %to).', array('%from' => $message['from'], '%to' => $message['to']), WATCHDOG_ERROR); + drupal_set_message(t('Unable to send e-mail. Please contact the site admin, if the problem persists.'), 'error'); + } } return $message; |