]> git.donarmstrong.com Git - roundcube.git/blob - plugins/additional_message_headers/additional_message_headers.php
Handle incorrect upgrade from 0.3.1-6 when "changed" column already
[roundcube.git] / plugins / additional_message_headers / additional_message_headers.php
1 <?php
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  *
9  * Enable the plugin in config/main.inc.php and add your desired headers:
10  * $rcmail_config['additional_message_headers'] = array('User-Agent');
11  *
12  * @version @package_version@
13  * @author Ziba Scott
14  * @website http://roundcube.net
15  */
16 class additional_message_headers extends rcube_plugin
17 {
18     public $task = 'mail';
19
20     function init()
21     {
22         $this->add_hook('message_outgoing_headers', array($this, 'message_headers'));
23     }
24
25     function message_headers($args)
26     {
27         $this->load_config();
28
29         // additional email headers
30         $additional_headers = rcmail::get_instance()->config->get('additional_message_headers',array());
31         foreach($additional_headers as $header=>$value){
32             if (null === $value) {
33                 unset($args['headers'][$header]);
34             } else {
35                 $args['headers'][$header] = $value;
36             }
37         }
38
39         return $args;
40     }
41 }
42
43 ?>