Files
roundcubemail/plugins/additional_message_headers/additional_message_headers.php
Michael Voříšek e7d7e62146 Modernize more basic CS II (#9254)
* fix "integer_literal_case"

* fix "phpdoc_separation"

* fix "phpdoc_var_without_name"

* fix "operator_linebreak"

* fix "no_alias_language_construct_call"

* fix "list_syntax"

* fix "concat_space"

* fix "array_syntax"

* fix "binary_operator_spaces"

* fix "binary_operator_spaces" relaxed

* fix "phpdoc_types_order"

* fix "phpdoc_trim"

* fix "native_type_declaration_casing"

* fix "method_chaining_indentation"

* fix "phpdoc_no_package"

* fix "elseif"

* fix PHP CS Fixer config itself too

* fix "native_type_declaration_casing"
2023-12-17 13:14:45 +01:00

49 lines
1.1 KiB
PHP

<?php
/**
* Additional Message Headers
*
* Very simple plugin which will add additional headers
* to or remove them from outgoing messages.
*
* Enable the plugin in config.inc.php and add your desired headers:
* $config['additional_message_headers'] = ['User-Agent' => 'My-Very-Own-Webmail'];
*
* @author Ziba Scott
*
* @website http://roundcube.net
*/
class additional_message_headers extends rcube_plugin
{
/**
* Plugin initialization
*/
function init()
{
$this->add_hook('message_before_send', [$this, 'message_headers']);
}
/**
* 'message_before_send' hook handler
*
* @param array $args Hook arguments
*
* @return array Modified hook arguments
*/
function message_headers($args)
{
$this->load_config();
$rcube = rcube::get_instance();
// additional email headers
$additional_headers = $rcube->config->get('additional_message_headers', []);
if (!empty($additional_headers)) {
$args['message']->headers($additional_headers, true);
}
return $args;
}
}