1
0
Fork 0

mail() requires additional headers to be separated by CRLF

- Rewrite Email->getAdditionalMailHeaderString to have only one string concatenation statement
This commit is contained in:
Hypolite Petovan 2022-11-13 02:28:06 -05:00
parent b1eba05e93
commit 4dc96daeb3
2 changed files with 10 additions and 9 deletions

View file

@ -135,14 +135,15 @@ class Email implements IEmail
$headerString = '';
foreach ($this->additionalMailHeader as $name => $values) {
if (is_array($values)) {
if (!is_array($values)) {
$values = [$values];
}
foreach ($values as $value) {
$headerString .= "$name: $value\n";
}
} else {
$headerString .= "$name: $values\n";
$headerString .= "$name: $value\r\n";
}
}
return $headerString;
}

View file

@ -163,9 +163,9 @@ class Emailer
// generate a multipart/alternative message header
$messageHeader = $email->getAdditionalMailHeaderString() .
"From: $fromName <{$fromAddress}>\n" .
"Reply-To: $fromName <{$replyTo}>\n" .
"MIME-Version: 1.0\n" .
"From: $fromName <{$fromAddress}>\r\n" .
"Reply-To: $fromName <{$replyTo}>\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
// assemble the final multipart message body with the text and html types included