From b91ffae29217d441445ed3931987119d33b6fa20 Mon Sep 17 00:00:00 2001 From: Hardway Hou Date: Tue, 24 May 2022 10:09:46 +0800 Subject: [PATCH 1/2] minor: Support html content in mailer.php --- classes/mailer.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/mailer.php b/classes/mailer.php index 60b1ce4fd..dcb22e6d6 100644 --- a/classes/mailer.php +++ b/classes/mailer.php @@ -45,7 +45,15 @@ class Mailer { ++$hooks_tried; } - $headers = [ "From: $from_combined", "Content-Type: text/plain; charset=UTF-8" ]; + $headers = [ "From: $from_combined" ]; + + if($message_html){ + $headers[]="MIME-Version: 1.0"; + $headers[]="Content-Type: text/html; charset=UTF-8"; + } + else{ + $headers[]="Content-Type: text/plain; charset=UTF-8"; + } $rc = mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers))); From 9e557501fae6f67f4dbd5cc121e1f45e5211c9a7 Mon Sep 17 00:00:00 2001 From: Hardway Hou Date: Tue, 24 May 2022 20:49:01 +0800 Subject: [PATCH 2/2] trivia: coding style --- classes/mailer.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/classes/mailer.php b/classes/mailer.php index dcb22e6d6..a15c8546b 100644 --- a/classes/mailer.php +++ b/classes/mailer.php @@ -47,12 +47,11 @@ class Mailer { $headers = [ "From: $from_combined" ]; - if($message_html){ - $headers[]="MIME-Version: 1.0"; - $headers[]="Content-Type: text/html; charset=UTF-8"; - } - else{ - $headers[]="Content-Type: text/plain; charset=UTF-8"; + if ($message_html) { + $headers[] = "MIME-Version: 1.0"; + $headers[] = "Content-Type: text/html; charset=UTF-8"; + } else { + $headers[] = "Content-Type: text/plain; charset=UTF-8"; } $rc = mail($to_combined, $subject, $message, implode("\r\n", array_merge($headers, $additional_headers)));