From c745e50a433dc1f44aa5ab9b2d833154168727a8 Mon Sep 17 00:00:00 2001 From: Frank Hochmuth Date: Fri, 29 Dec 2023 19:22:06 +0100 Subject: [PATCH] Encodes $subject with MIME base64 --- fp-includes/core/core.wp-pluggable-funcs.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fp-includes/core/core.wp-pluggable-funcs.php b/fp-includes/core/core.wp-pluggable-funcs.php index 3f00016..237b416 100755 --- a/fp-includes/core/core.wp-pluggable-funcs.php +++ b/fp-includes/core/core.wp-pluggable-funcs.php @@ -178,10 +178,15 @@ if (!function_exists('wp_mail')) : function wp_mail($to, $subject, $message, $headers = '') { if ($headers == '') { - $headers = "MIME-Version: 1.0\n" . "From: " . get_settings('admin_email') . "\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n"; + $headers = "MIME-Version: 1.0\r\n" . // + "From: " . get_settings('admin_email') . "\r\n" . // + "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n"; } - - return @mail($to, $subject, $message, $headers); + /* + * for non-ASCII characters in the e-mail header use RFC 1342 — Encodes $subject with MIME base64 + * https://ncona.com/2011/06/using-utf-8-characters-on-an-e-mail-subject/ + */ + return @mail($to, '=?' . get_settings('blog_charset') . '?B?' . base64_encode($subject) . '?=', $message, $headers); } endif;