diff options
Diffstat (limited to 'classes/mailer.php')
-rw-r--r-- | classes/mailer.php | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/classes/mailer.php b/classes/mailer.php index a15c8546b..ac5c641eb 100644 --- a/classes/mailer.php +++ b/classes/mailer.php @@ -1,8 +1,6 @@ <?php class Mailer { - // TODO: class properties can be switched to PHP typing if/when the minimum PHP_VERSION is raised to 7.4.0+ - /** @var string */ - private $last_error = ""; + private string $last_error = ""; /** * @param array<string, mixed> $params @@ -45,16 +43,9 @@ class Mailer { ++$hooks_tried; } - $headers = [ "From: $from_combined" ]; + $headers = [ "From: $from_combined", "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))); + $rc = mail($to_combined, $subject, $message, implode("\r\n", [...$headers, ...$additional_headers])); if (!$rc) { $this->set_error(error_get_last()['message'] ?? T_sprintf("Unknown error while sending mail. Hooks tried: %d.", $hooks_tried)); |