1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/16879] Add event core.phpbb_mail_after

PHPBB3-16879
This commit is contained in:
3D-I 2021-09-19 03:00:53 +02:00
parent ed33f06235
commit 54b54c41c6

View File

@ -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();