mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #6240 Line length of emails sent out by Mailer.php set too long and could cause emails to be marked as spam by certain filters (thanks florian.thoma!)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115155 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fc3101760f
commit
6faf418693
@ -46,7 +46,7 @@ class Mailer extends Object {
|
|||||||
function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false) {
|
function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $customheaders = false, $plainContent = false, $inlineImages = false) {
|
||||||
if ($customheaders && is_array($customheaders) == false) {
|
if ($customheaders && is_array($customheaders) == false) {
|
||||||
echo "htmlEmail($to, $from, $subject, ...) could not send mail: improper \$customheaders passed:<BR>";
|
echo "htmlEmail($to, $from, $subject, ...) could not send mail: improper \$customheaders passed:<BR>";
|
||||||
dieprintr($headers);
|
dieprintr($customheaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
|
|||||||
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
||||||
$headers["Content-Transfer-Encoding"] = $plainEncoding ? $plainEncoding : "quoted-printable";
|
$headers["Content-Transfer-Encoding"] = $plainEncoding ? $plainEncoding : "quoted-printable";
|
||||||
|
|
||||||
$plainPart = processHeaders($headers, ($plainEncoding == "base64") ? chunk_split(base64_encode($plainContent),60) : wordwrap(QuotedPrintable_encode($plainContent),120));
|
$plainPart = processHeaders($headers, ($plainEncoding == "base64") ? chunk_split(base64_encode($plainContent),60) : wordwrap(QuotedPrintable_encode($plainContent),75));
|
||||||
|
|
||||||
// Make the HTML part
|
// Make the HTML part
|
||||||
$headers["Content-Type"] = "text/html; charset=\"utf-8\"";
|
$headers["Content-Type"] = "text/html; charset=\"utf-8\"";
|
||||||
@ -93,7 +93,7 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
|
|||||||
$htmlPart = wrapImagesInline($htmlContent);
|
$htmlPart = wrapImagesInline($htmlContent);
|
||||||
} else {
|
} else {
|
||||||
$headers["Content-Transfer-Encoding"] = "quoted-printable";
|
$headers["Content-Transfer-Encoding"] = "quoted-printable";
|
||||||
$htmlPart = processHeaders($headers, wordwrap(QuotedPrintable_encode($htmlContent),120));
|
$htmlPart = processHeaders($headers, wordwrap(QuotedPrintable_encode($htmlContent),75));
|
||||||
}
|
}
|
||||||
|
|
||||||
list($messageBody, $messageHeaders) = encodeMultipart(array($plainPart,$htmlPart), "multipart/alternative");
|
list($messageBody, $messageHeaders) = encodeMultipart(array($plainPart,$htmlPart), "multipart/alternative");
|
||||||
@ -171,7 +171,7 @@ function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $cu
|
|||||||
|
|
||||||
if ($customheaders && is_array($customheaders) == false) {
|
if ($customheaders && is_array($customheaders) == false) {
|
||||||
echo "htmlEmail($to, $from, $subject, ...) could not send mail: improper \$customheaders passed:<BR>";
|
echo "htmlEmail($to, $from, $subject, ...) could not send mail: improper \$customheaders passed:<BR>";
|
||||||
dieprintr($headers);
|
dieprintr($customheaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the subject line contains extended characters, we must encode it
|
// If the subject line contains extended characters, we must encode it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user