LSaddon::mail: Fix handling multiple recipients

This commit is contained in:
Benjamin Renard 2024-02-19 19:30:07 +01:00
parent 34396a5fe1
commit 15e3ffe6ef
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -154,9 +154,7 @@ function sendMail($to, $subject, $msg, $headers=null, $attachments=null,
$headers["To"] = $to; $headers["To"] = $to;
$to = array ( $to = ensureIsArray($to);
'To' => $to
);
foreach(array_keys($headers) as $header) { foreach(array_keys($headers) as $header) {
if(in_array(strtoupper($header), array('BCC', 'CC'))) { if(in_array(strtoupper($header), array('BCC', 'CC'))) {
@ -173,7 +171,7 @@ function sendMail($to, $subject, $msg, $headers=null, $attachments=null,
unset($headers[$header]); unset($headers[$header]);
continue; continue;
} }
$to[strtoupper($header)] = $headers[$header]; $to = array_merge($to, $headers[$header]);
} }
} }