diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-08-25 09:03:01 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-08-25 09:03:01 +0200 |
commit | 6efadfc8d38730f3ee6d0bbcd53bdc24ef094116 (patch) | |
tree | 90c47cd6bf66152001d6f66e741c902f5f8c5ccd /plugins/additional_message_headers/additional_message_headers.php | |
parent | 1305079d75413743c3954ae0c3a1757b38676782 (diff) |
Fix so additional headers are added to all messages sent (#1489284)
Diffstat (limited to 'plugins/additional_message_headers/additional_message_headers.php')
-rw-r--r-- | plugins/additional_message_headers/additional_message_headers.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/additional_message_headers/additional_message_headers.php b/plugins/additional_message_headers/additional_message_headers.php index c54f77d2d..0d16e605e 100644 --- a/plugins/additional_message_headers/additional_message_headers.php +++ b/plugins/additional_message_headers/additional_message_headers.php @@ -15,27 +15,32 @@ */ class additional_message_headers extends rcube_plugin { - public $task = 'mail'; - function init() { - $this->add_hook('message_outgoing_headers', array($this, 'message_headers')); + $this->add_hook('message_before_send', array($this, 'message_headers')); } function message_headers($args) { - $this->load_config(); + $this->load_config(); + + $headers = $args['message']->headers(); + $rcube = rcube::get_instance(); // additional email headers - $additional_headers = rcmail::get_instance()->config->get('additional_message_headers',array()); - foreach($additional_headers as $header=>$value){ + $additional_headers = $rcube->config->get('additional_message_headers', array()); + foreach ((array)$additional_headers as $header => $value) { if (null === $value) { - unset($args['headers'][$header]); - } else { - $args['headers'][$header] = $value; + unset($headers[$header]); + } + else { + $headers[$header] = $value; } } + $args['message']->_headers = array(); + $args['message']->headers($headers); + return $args; } } |