From 54b54c41c600517df6cda12b4f7db12990fe58f7 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Sun, 19 Sep 2021 03:00:53 +0200 Subject: [PATCH 1/4] [ticket/16879] Add event core.phpbb_mail_after PHPBB3-16879 --- phpBB/includes/functions_messenger.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f8fae85b13..47b576670a 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1906,7 +1906,7 @@ function mail_encode($str, $eol = "\r\n") */ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) { - global $config, $phpbb_root_path, $phpEx; + global $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher; // Convert Numeric Character References to UTF-8 chars (ie. Emojis) $subject = utf8_decode_ncr($subject); @@ -1937,6 +1937,30 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); + /** + * Implement some code after sending out emails with the PHP's mail function + * + * @event core.phpbb_mail_after + * @var string to The message recipient + * @var string subject The message subject + * @var string msg The message text + * @var string headers The email headers + * @var string eol The endline character + * @var string additional_parameters The additional parameters + * @var bool result True if the email was sent, false otherwise + * @since 3.3.5-RC1 + */ + $vars = [ + 'to', + 'subject', + 'msg', + 'headers', + 'eol', + 'additional_parameters', + 'result', + ]; + extract($phpbb_dispatcher->trigger_event('core.phpbb_mail_after', compact($vars))); + $collector->uninstall(); $err_msg = $collector->format_errors(); From 303a933403eb52af39f27cfed96b40ba4f1ba5ad Mon Sep 17 00:00:00 2001 From: 3D-I Date: Sun, 19 Sep 2021 03:59:17 +0200 Subject: [PATCH 2/4] [ticket/16879] Add events to phpbb_mail() PHPBB3-16879 --- phpBB/includes/functions_messenger.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 47b576670a..56be0b6bbe 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1935,10 +1935,32 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) */ $additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : ''; + /** + * Modify data before sending out emails with the PHP's mail function + * + * @event core.phpbb_mail_before + * @var string to The message recipient + * @var string subject The message subject + * @var string msg The message text + * @var string headers The email headers + * @var string eol The endline character + * @var string additional_parameters The additional parameters + * @since 3.3.5-RC1 + */ + $vars = [ + 'to', + 'subject', + 'msg', + 'headers', + 'eol', + 'additional_parameters', + ]; + extract($phpbb_dispatcher->trigger_event('core.phpbb_mail_before', compact($vars))); + $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); /** - * Implement some code after sending out emails with the PHP's mail function + * Execute code after sending out emails with the PHP's mail function * * @event core.phpbb_mail_after * @var string to The message recipient From 27289cbfad52379badd3be8c59d87c239438b5c0 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Mon, 20 Sep 2021 22:02:17 +0200 Subject: [PATCH 3/4] [ticket/16879] Add events to phpbb_mail() PHPBB3-16879 --- phpBB/includes/functions_messenger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 56be0b6bbe..a40405b599 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1945,7 +1945,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) * @var string headers The email headers * @var string eol The endline character * @var string additional_parameters The additional parameters - * @since 3.3.5-RC1 + * @since 3.3.6-RC1 */ $vars = [ 'to', @@ -1970,7 +1970,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) * @var string eol The endline character * @var string additional_parameters The additional parameters * @var bool result True if the email was sent, false otherwise - * @since 3.3.5-RC1 + * @since 3.3.6-RC1 */ $vars = [ 'to', From 19076de94c76d379068c2098db45c319e4baf310 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Wed, 22 Sep 2021 22:39:09 +0200 Subject: [PATCH 4/4] [ticket/16879] Add events to phpbb_mail() PHPBB3-16879 --- phpBB/includes/functions_messenger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index a40405b599..d3228fd659 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -1936,7 +1936,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) $additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : ''; /** - * Modify data before sending out emails with the PHP's mail function + * Modify data before sending out emails with PHP's mail function * * @event core.phpbb_mail_before * @var string to The message recipient @@ -1960,7 +1960,7 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); /** - * Execute code after sending out emails with the PHP's mail function + * Execute code after sending out emails with PHP's mail function * * @event core.phpbb_mail_after * @var string to The message recipient