summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2015-03-31 16:07:51 +0200
committerAleksander Machniak <alec@alec.pl>2015-03-31 16:07:51 +0200
commit0a4e0921d3c4e4e1e485f43dc05bf0447fbc846a (patch)
tree6046fd38b10ee1e21cdd104e7a9bfcd5ba16ee16 /program
parente6c1e0c6383ae4b138080bcfa033e13f9576ecad (diff)
Plugin API: Added message_ready hook - the last chance to modify Mail_Mime object before saving or sending the message
Diffstat (limited to 'program')
-rw-r--r--program/steps/mail/sendmail.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 5326d6452..b3034f57d 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -113,6 +113,12 @@ else if ($from_string = rcmail_email_input_format($from)) {
$from = null;
}
+// check 'From' address (identity may be incomplete)
+if (!$savedraft && !$saveonly && empty($from)) {
+ $OUTPUT->show_message('nofromaddress', 'error');
+ $OUTPUT->send('iframe');
+}
+
if (!$from_string && $from) {
$from_string = $from;
}
@@ -508,14 +514,12 @@ $MAIL_MIME->setParam('text_charset', $text_charset);
// pass headers to message object
$MAIL_MIME->headers($headers);
+// This hook allows to modify the message before send or save action
+$plugin = $RCMAIL->plugins->exec_hook('message_ready', array('message' => $MAIL_MIME));
+$MAIL_MIME = $plugin['message'];
+
// Begin SMTP Delivery Block
if (!$savedraft && !$saveonly) {
- // check 'From' address (identity may be incomplete)
- if (empty($from)) {
- $OUTPUT->show_message('nofromaddress', 'error');
- $OUTPUT->send('iframe');
- }
-
// Handle Delivery Status Notification request
$smtp_opts['dsn'] = $dsn_enabled;