Fixed indentation in Mailer

No functional changes
This commit is contained in:
Ingo Schommer 2013-01-30 12:52:18 +01:00
parent 7327f120aa
commit 7f4c173369

View File

@ -56,7 +56,6 @@ class Mailer {
} }
} }
// We further wrap all of this into another multipart block // We further wrap all of this into another multipart block
list($fullBody, $headers) = $this->encodeMultipart($messageParts, "multipart/mixed"); list($fullBody, $headers) = $this->encodeMultipart($messageParts, "multipart/mixed");
@ -121,7 +120,6 @@ class Mailer {
dieprintr($customheaders); dieprintr($customheaders);
} }
$bodyIsUnicode = (strpos($htmlContent,"&#") !== false); $bodyIsUnicode = (strpos($htmlContent,"&#") !== false);
$plainEncoding = ""; $plainEncoding = "";
@ -132,7 +130,6 @@ class Mailer {
if(isset($bodyIsUnicode) && $bodyIsUnicode) $plainEncoding = "base64"; if(isset($bodyIsUnicode) && $bodyIsUnicode) $plainEncoding = "base64";
} }
// 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);
$subject = "=?UTF-8?B?" . base64_encode($subject) . "?="; $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
@ -148,7 +145,6 @@ class Mailer {
// Make the HTML part // Make the HTML part
$headers["Content-Type"] = "text/html; charset=utf-8"; $headers["Content-Type"] = "text/html; charset=utf-8";
// Add basic wrapper tags if the body tag hasn't been given // Add basic wrapper tags if the body tag hasn't been given
if(stripos($htmlContent, '<body') === false) { if(stripos($htmlContent, '<body') === false) {
$htmlContent = $htmlContent =
@ -223,7 +219,6 @@ class Mailer {
if (isset($headers['BCC'])) {$headers['Bcc']=$headers['BCC']; unset($headers['BCC']); } if (isset($headers['BCC'])) {$headers['Bcc']=$headers['BCC']; unset($headers['BCC']); }
if (isset($headers['bcc'])) {$headers['Bcc']=$headers['bcc']; unset($headers['bcc']); } if (isset($headers['bcc'])) {$headers['Bcc']=$headers['bcc']; unset($headers['bcc']); }
// Send the email // Send the email
$headers = $this->processHeaders($headers); $headers = $this->processHeaders($headers);
$to = $this->validEmailAddr($to); $to = $this->validEmailAddr($to);
@ -256,7 +251,6 @@ function encodeMultipart($parts, $contentType, $headers = false) {
$baseMessage = "\nThis is a multi-part message in MIME format."; $baseMessage = "\nThis is a multi-part message in MIME format.";
} }
$separator = "\n--$separator\n"; $separator = "\n--$separator\n";
$body = "$baseMessage\n" . $body = "$baseMessage\n" .
$separator . implode("\n".$separator, $parts) . "\n" . trim($separator) . "--"; $separator . implode("\n".$separator, $parts) . "\n" . trim($separator) . "--";
@ -269,9 +263,13 @@ function encodeMultipart($parts, $contentType, $headers = false) {
*/ */
function processHeaders($headers, $body = false) { function processHeaders($headers, $body = false) {
$res = ''; $res = '';
if(is_array($headers)) while(list($k, $v) = each($headers)) if(is_array($headers)) {
while(list($k, $v) = each($headers)) {
$res .= "$k: $v\n"; $res .= "$k: $v\n";
}
}
if($body) $res .= "\n$body"; if($body) $res .= "\n$body";
return $res; return $res;
} }
@ -409,7 +407,6 @@ function validEmailAddr($emailAddress) {
$replacedContent = imageRewriter($htmlContent, 'wrapImagesInline_rewriter($URL)'); $replacedContent = imageRewriter($htmlContent, 'wrapImagesInline_rewriter($URL)');
// Make the HTML part // Make the HTML part
$headers["Content-Type"] = "text/html; charset=utf-8"; $headers["Content-Type"] = "text/html; charset=utf-8";
$headers["Content-Transfer-Encoding"] = "quoted-printable"; $headers["Content-Transfer-Encoding"] = "quoted-printable";