From cc016b24d7ac74645c5bdad614fbb9baa8a8da4b Mon Sep 17 00:00:00 2001 From: Josaphat Imani Date: Sat, 2 Nov 2024 10:23:47 +0200 Subject: [PATCH] Add possibility to pass compose subject in url --- modules/smtp/modules.php | 15 ++++++++++++++- modules/smtp/setup.php | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index 053638eb24..f0b991be89 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -862,6 +862,19 @@ public function process() } } +/** + * Determine if composer_from is set + * @subpackage smtp/handler + */ +class Hm_Handler_smtp_subject_replace extends Hm_Handler_Module { + public function process() + { + if (array_key_exists('compose_subject', $this->request->get)) { + $this->out('compose_subject', $this->request->get['compose_subject']); + } + } +} + /** * Determine if auto-bcc is active * @subpackage smtp/handler @@ -1085,7 +1098,6 @@ protected function output() { class Hm_Output_compose_form_content extends Hm_Output_Module { protected function output() { $to = ''; - $subject = ''; $body = ''; $files = $this->get('uploaded_files', array()); $cc = ''; @@ -1101,6 +1113,7 @@ protected function output() { $msg_path = $this->get('list_path', ''); $msg_uid = $this->get('uid', ''); $from = $this->get('compose_from'); + $subject = $this->get('compose_subject'); $forward_as_attachment=$this->get('as_attr'); if (!$msg_path) { diff --git a/modules/smtp/setup.php b/modules/smtp/setup.php index edb7987acb..199a9c781c 100644 --- a/modules/smtp/setup.php +++ b/modules/smtp/setup.php @@ -9,6 +9,7 @@ add_handler('compose', 'load_smtp_reply_to_details', true, 'smtp', 'load_user_data', 'after'); add_handler('compose', 'load_smtp_is_imap_draft', true, 'smtp', 'load_user_data', 'after'); add_handler('compose', 'smtp_from_replace', true, 'smtp', 'load_user_data', 'after'); +add_handler('compose', 'smtp_subject_replace', true, 'smtp', 'load_user_data', 'after'); add_handler('compose', 'load_smtp_servers_from_config', true, 'smtp', 'load_smtp_reply_to_details', 'after'); add_handler('compose', 'add_smtp_servers_to_page_data', true, 'smtp', 'load_smtp_servers_from_config', 'after'); add_handler('compose', 'process_compose_form_submit', true, 'smtp', 'load_smtp_servers_from_config', 'after'); @@ -127,6 +128,7 @@ 'compose_to' => FILTER_DEFAULT, 'mailto_uri' => FILTER_DEFAULT, 'compose_from' => FILTER_DEFAULT, + 'compose_subject' => FILTER_DEFAULT, 'resumableChunkNumber' => FILTER_VALIDATE_INT, 'resumableTotalChunks' => FILTER_VALIDATE_INT, 'resumableChunkSize' => FILTER_VALIDATE_INT,