summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-05 09:34:03 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-03-05 09:34:03 +0000
commitdcb943bbe588c5e1cbf580b451503893c35f440c (patch)
tree394aa280014fefc24c6adac9444b7759f107187b
parent8991f07a99ff0f50ded5008e9cd4053f3b7780ab (diff)
Allow outgoing_message_headers hook to abort message sending
git-svn-id: https://svn.roundcube.net/trunk@3322 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/program/steps/mail/sendmail.inc15
1 files changed, 12 insertions, 3 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc
index abd4209c3..acff62d79 100644
--- a/roundcubemail/program/steps/mail/sendmail.inc
+++ b/roundcubemail/program/steps/mail/sendmail.inc
@@ -344,6 +344,18 @@ $headers['X-Sender'] = $from;
if (!empty($CONFIG['useragent']))
$headers['User-Agent'] = $CONFIG['useragent'];
+// exec hook for header checking and manipulation
+$data = $RCMAIL->plugins->exec_hook('outgoing_message_headers', array('headers' => $headers));
+
+// sending aborted by plugin
+if ($data['abort'] && !$savedraft) {
+ $OUTPUT->show_message($data['message'] ? $data['message'] : 'sendingfailed');
+ $OUTPUT->send('iframe');
+}
+else
+ $headers = $data['headers'];
+
+
$isHtmlVal = strtolower(get_input_value('_is_html', RCUBE_INPUT_POST));
$isHtml = ($isHtmlVal == "1");
@@ -474,9 +486,6 @@ $MAIL_MIME->setParam('head_charset', $message_charset);
$MAIL_MIME->setParam('html_charset', $message_charset);
$MAIL_MIME->setParam('text_charset', $message_charset);
-$data = $RCMAIL->plugins->exec_hook('outgoing_message_headers', array('headers' => $headers));
-$headers = $data['headers'];
-
// encoding subject header with mb_encode provides better results with asian characters
if (function_exists('mb_encode_mimeheader'))
{