mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
0a01b3bcc8
1 changed files with 18 additions and 7 deletions
|
@ -1897,8 +1897,15 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
|
||||||
{
|
{
|
||||||
global $config, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
// We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
|
// Convert Numeric Character References to UTF-8 chars (ie. Emojis)
|
||||||
// Reference: http://bugs.php.net/bug.php?id=15841
|
$subject = utf8_decode_ncr($subject);
|
||||||
|
$msg = utf8_decode_ncr($msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings.
|
||||||
|
* On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used...
|
||||||
|
* Reference: http://bugs.php.net/bug.php?id=15841
|
||||||
|
*/
|
||||||
$headers = implode($eol, $headers);
|
$headers = implode($eol, $headers);
|
||||||
|
|
||||||
if (!class_exists('\phpbb\error_collector'))
|
if (!class_exists('\phpbb\error_collector'))
|
||||||
|
@ -1909,10 +1916,14 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
|
||||||
$collector = new \phpbb\error_collector;
|
$collector = new \phpbb\error_collector;
|
||||||
$collector->install();
|
$collector->install();
|
||||||
|
|
||||||
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
/**
|
||||||
// Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
|
* On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
||||||
// Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used)
|
* Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8.
|
||||||
|
* Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space
|
||||||
|
* (Use '' as parameter to mail_encode() results in SPACE used)
|
||||||
|
*/
|
||||||
$additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : '';
|
$additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : '';
|
||||||
|
|
||||||
$result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters);
|
$result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters);
|
||||||
|
|
||||||
$collector->uninstall();
|
$collector->uninstall();
|
||||||
|
|
Loading…
Add table
Reference in a new issue