| 1 |
<?php |
<?php |
| 2 |
// $Id: mailhandler.module,v 1.87.2.9 2008/05/02 17:32:18 weitzman Exp $ |
// $Id: mailhandler.module,v 1.87.2.10 2008/07/06 20:07:09 weitzman Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Retrieve all msgs from a given mailbox and process them. |
* Retrieve all msgs from a given mailbox and process them. |
| 127 |
list($fromaddress, $fromname) = mailhandler_get_fromaddress($header, $mailbox); |
list($fromaddress, $fromname) = mailhandler_get_fromaddress($header, $mailbox); |
| 128 |
$error_txt = t("Sorry, your comment experienced an error and was not posted. Possible reasons are\n- you have insufficient permission to post comments\n- The node is no longer open for comments.\n\n"); |
$error_txt = t("Sorry, your comment experienced an error and was not posted. Possible reasons are\n- you have insufficient permission to post comments\n- The node is no longer open for comments.\n\n"); |
| 129 |
$error = $error_txt. t("\n\nYou sent:\n\nFrom: %f\nSubject: %t\nBody:\n%b", array('%f' => $fromaddress, '%t' => $header->subject, '%b' => $origbody)); |
$error = $error_txt. t("\n\nYou sent:\n\nFrom: %f\nSubject: %t\nBody:\n%b", array('%f' => $fromaddress, '%t' => $header->subject, '%b' => $origbody)); |
| 130 |
$sitemail = variable_get('site_mail', ini_get('sendmail_from')); |
drupal_mail('mailhandler_error_comment', $fromaddress, t('Email submission to %sn failed - %subj', array('%sn' => variable_get('site_name', 'Drupal'), '%subj' => $header->subject))); |
|
$headers = "From: $sitemail\nReply-to: $sitemail\nX-Mailer: Drupal\nReturn-path: $sitemail\nErrors-to: $sitemail"; |
|
|
drupal_mail($fromaddress, t('Email submission to %sn failed - %subj', array('%sn' => variable_get('site_name', 'Drupal'), '%subj' => $header->subject)), $error, $headers); |
|
| 131 |
$watchdog = t('Mailhandler: comment submission failure: %subject.', array('%subject' => $edit['subject'])); |
$watchdog = t('Mailhandler: comment submission failure: %subject.', array('%subject' => $edit['subject'])); |
| 132 |
watchdog('mailhandler', $watchdog, WATCHDOG_ERROR); |
watchdog('mailhandler', $watchdog, WATCHDOG_ERROR); |
| 133 |
} |
} |
| 158 |
// See http://drupal.org/node/271975 for more info. |
// See http://drupal.org/node/271975 for more info. |
| 159 |
// Warning: with this method, if the same error message is reported for 2+ different |
// Warning: with this method, if the same error message is reported for 2+ different |
| 160 |
// fields it will be detected only for the last one. |
// fields it will be detected only for the last one. |
|
|
|
| 161 |
if (!isset($_SESSION['messages'])) { |
if (!isset($_SESSION['messages'])) { |
| 162 |
$_SESSION['messages'] = array(); |
$_SESSION['messages'] = array(); |
| 163 |
} |
} |
| 215 |
watchdog('mailhandler', "Mailhandler: $errortxt", WATCHDOG_ERROR); |
watchdog('mailhandler', "Mailhandler: $errortxt", WATCHDOG_ERROR); |
| 216 |
if ($mailbox['replies']) { |
if ($mailbox['replies']) { |
| 217 |
$errortxt .= t("\n\nYou sent:\n\nFrom: %f\nSubject: %t\nBody:\n%b", array('%f' => $fromaddress, '%t' => $header->subject, '%b' => $origbody)); |
$errortxt .= t("\n\nYou sent:\n\nFrom: %f\nSubject: %t\nBody:\n%b", array('%f' => $fromaddress, '%t' => $header->subject, '%b' => $origbody)); |
| 218 |
$sitemail = variable_get('site_mail', ini_get('sendmail_from')); |
drupal_mail('mailhandler_error_node', $fromaddress, t('Email submission to %sn failed - %subj', array('%sn' => variable_get('site_name', 'Drupal'), '%subj' => $node->title)), $errortxt); |
|
$headers = "From: $sitemail\nReply-to: $sitemail\nX-Mailer: Drupal\nReturn-path: $sitemail\nErrors-to: $sitemail"; |
|
|
drupal_mail($fromaddress, t('Email submission to %sn failed - %subj', array('%sn' => variable_get('site_name', 'Drupal'), '%subj' => $node->title)), $errortxt, $headers); |
|
| 219 |
} |
} |
| 220 |
} |
} |
| 221 |
} |
} |