mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Always encode email subject as UTF-8 (thanks syntax!)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@115151 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c7a98407b1
commit
fc3101760f
@ -50,7 +50,6 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$subjectIsUnicode = (strpos($subject,"&#") !== false);
|
|
||||||
$bodyIsUnicode = (strpos($htmlContent,"&#") !== false);
|
$bodyIsUnicode = (strpos($htmlContent,"&#") !== false);
|
||||||
$plainEncoding = "";
|
$plainEncoding = "";
|
||||||
|
|
||||||
@ -64,9 +63,7 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
|
|||||||
|
|
||||||
// If the subject line contains extended characters, we must encode the
|
// If the subject line contains extended characters, we must encode the
|
||||||
$subject = Convert::xml2raw($subject);
|
$subject = Convert::xml2raw($subject);
|
||||||
if(isset($subjectIsUnicode) && $subjectIsUnicode)
|
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
|
||||||
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
|
|
||||||
|
|
||||||
|
|
||||||
// Make the plain text part
|
// Make the plain text part
|
||||||
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
||||||
@ -170,7 +167,6 @@ function htmlEmail($to, $from, $subject, $htmlContent, $attachedFiles = false, $
|
|||||||
* Send a plain text e-mail
|
* Send a plain text e-mail
|
||||||
*/
|
*/
|
||||||
function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false) {
|
function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $customheaders = false) {
|
||||||
$subjectIsUnicode = false;
|
|
||||||
$plainEncoding = false; // Not ensurely where this is supposed to be set, but defined it false for now to remove php notices
|
$plainEncoding = false; // Not ensurely where this is supposed to be set, but defined it false for now to remove php notices
|
||||||
|
|
||||||
if ($customheaders && is_array($customheaders) == false) {
|
if ($customheaders && is_array($customheaders) == false) {
|
||||||
@ -178,13 +174,9 @@ function plaintextEmail($to, $from, $subject, $plainContent, $attachedFiles, $cu
|
|||||||
dieprintr($headers);
|
dieprintr($headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strpos($subject,"&#") !== false) $subjectIsUnicode = true;
|
|
||||||
|
|
||||||
// If the subject line contains extended characters, we must encode it
|
// If the subject line contains extended characters, we must encode it
|
||||||
$subject = Convert::xml2raw($subject);
|
$subject = Convert::xml2raw($subject);
|
||||||
if($subjectIsUnicode)
|
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
|
||||||
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
|
|
||||||
|
|
||||||
|
|
||||||
// Make the plain text part
|
// Make the plain text part
|
||||||
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
$headers["Content-Type"] = "text/plain; charset=\"utf-8\"";
|
||||||
|
Loading…
Reference in New Issue
Block a user