LSaddon::mail: fix handling the parameter of the sendMailFromTemplate function

This commit is contained in:
Benjamin Renard 2024-08-06 18:36:10 +02:00
parent d6a080c22c
commit 60a78290a9
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -403,7 +403,7 @@ function get_mail_template_saved_path($template, $extension) {
/**
* Send email from template
* @param string $tplname The email template name
* @param string $to The email recipient
* @param string|array<string> $to The email recipient(s)
* @param array<string,mixed> $variables Variables to use to compute the template
* @param array<string,string>|null $headers Email headers
* @param array<string,string>|null $attachments Email attachments as an array with
@ -431,6 +431,8 @@ function sendMailFromTemplate(
if (is_array($variables))
array_map([$smarty, "assign"], array_keys($variables), array_values($variables));
$to = ensureIsArray($to);
try {
$subject = $smarty -> fetch("file:{$tpl['subject']}");
// Multiple line from subject cause problem, trim it and only the first line