Aleksander Machniak
2016-05-22 87cf0a3fb158b5ffaa54a79997d7b01492d39b74
commit | author | age
48e9c1 1 <?php
T 2
3 /**
4  * Additional Message Headers
5  *
6  * Very simple plugin which will add additional headers
7  * to or remove them from outgoing messages.
8  *
461a30 9  * Enable the plugin in config.inc.php and add your desired headers:
465fc3 10  * $config['additional_message_headers'] = array('User-Agent' => 'My-Very-Own-Webmail');
48e9c1 11  *
T 12  * @version @package_version@
13  * @author Ziba Scott
14  * @website http://roundcube.net
15  */
16 class additional_message_headers extends rcube_plugin
17 {
18     function init()
19     {
6efadf 20         $this->add_hook('message_before_send', array($this, 'message_headers'));
48e9c1 21     }
T 22
23     function message_headers($args)
24     {
6efadf 25         $this->load_config();
AM 26
89a49d 27         $rcube = rcube::get_instance();
48e9c1 28
T 29         // additional email headers
6efadf 30         $additional_headers = $rcube->config->get('additional_message_headers', array());
48e9c1 31
89a49d 32         if (!empty($additional_headers)) {
AM 33             $args['message']->headers($additional_headers, true);
34         }
6efadf 35
48e9c1 36         return $args;
T 37     }
38 }