Remove html tags from email function

Not supported by many clients
This commit is contained in:
slawkens
2026-01-15 21:46:55 +01:00
parent a60a23b84f
commit 6661c78dac

View File

@@ -878,11 +878,12 @@ function getWorldName($id)
* *
* @param string $to Recipient email address. * @param string $to Recipient email address.
* @param string $subject Subject of the message. * @param string $subject Subject of the message.
* @param string $body Message body in html format. * @param string $body Message body in HTML format.
* @param string $altBody Alternative message body, plain text. * @param string $altBody Alternative message body, plain text.
* @return bool PHPMailer status returned (success/failure). * @return bool PHPMailer status returned (success/failure).
* @throws \PHPMailer\PHPMailer\Exception
*/ */
function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true) function _mail(string $to, string $subject, string $body, string $altBody = ''): bool
{ {
global $mailer, $config; global $mailer, $config;
@@ -900,12 +901,6 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->clearAllRecipients(); $mailer->clearAllRecipients();
} }
$signature_html = setting('core.mail_signature_html');
if($add_html_tags && isset($body[0]))
$tmp_body = '<html><head></head><body>' . $body . '<br/><br/>' . $signature_html . '</body></html>';
else
$tmp_body = $body . '<br/><br/>' . $signature_html;
$mailOption = setting('core.mail_option'); $mailOption = setting('core.mail_option');
if($mailOption == MAIL_SMTP) if($mailOption == MAIL_SMTP)
{ {
@@ -932,6 +927,9 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->isMail(); $mailer->isMail();
} }
$signature_html = setting('core.mail_signature_html');
$tmp_body = $body . '<br/><br/>' . $signature_html;
$mailer->isHTML(isset($body[0]) > 0); $mailer->isHTML(isset($body[0]) > 0);
$mailer->From = setting('core.mail_address'); $mailer->From = setting('core.mail_address');
$mailer->Sender = setting('core.mail_address'); $mailer->Sender = setting('core.mail_address');