From 5a86c344eddb9fdb64b43b4dfddbefb2db8bd354 Mon Sep 17 00:00:00 2001 From: Marius Burkard Date: Mon, 24 Apr 2017 13:22:38 +0200 Subject: [PATCH] - fixed mail content-type / charset and boundary problem --- interface/lib/classes/ispcmail.inc.php | 12 ++++-------- server/lib/classes/ispcmail.inc.php | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/interface/lib/classes/ispcmail.inc.php b/interface/lib/classes/ispcmail.inc.php index 1c0a2d3eaa..b818e1e44a 100644 --- a/interface/lib/classes/ispcmail.inc.php +++ b/interface/lib/classes/ispcmail.inc.php @@ -433,20 +433,17 @@ class ispcmail { $textonly = true; } elseif($text == true && $html == false && $attach == true) { // text and attachment - $content_type = 'multipart/mixed;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"'; } elseif($html == true && $text == true && $attach == false) { // html only (or text too) - $content_type = 'multipart/alternative;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/alternative; boundary="' . $this->mime_boundary . '"'; } elseif($html == true && $text == false && $attach == false) { // html only (or text too) $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; $htmlonly = true; } elseif($html == true && $attach == true) { // html and attachments - $content_type = 'multipart/mixed;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"'; } $this->headers['Content-Type'] = $content_type; @@ -475,8 +472,7 @@ class ispcmail { if($attach) { foreach($this->attachments as $att) { $this->body .= "--{$this->mime_boundary}\n" . - "Content-Type: " . $att['type'] . ";\n" . - " name=\"" . $att['filename'] . "\"\n" . + "Content-Type: " . $att['type'] . "; name=\"" . $att['filename'] . "\"\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: attachment;\n\n" . chunk_split(base64_encode($att['content'])) . "\n\n"; diff --git a/server/lib/classes/ispcmail.inc.php b/server/lib/classes/ispcmail.inc.php index c92601cd3e..305b39f35b 100644 --- a/server/lib/classes/ispcmail.inc.php +++ b/server/lib/classes/ispcmail.inc.php @@ -433,20 +433,17 @@ class ispcmail { $textonly = true; } elseif($text == true && $html == false && $attach == true) { // text and attachment - $content_type = 'multipart/mixed;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"'; } elseif($html == true && $text == true && $attach == false) { // html only (or text too) - $content_type = 'multipart/alternative;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/alternative; boundary="' . $this->mime_boundary . '"'; } elseif($html == true && $text == false && $attach == false) { // html only (or text too) $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; $htmlonly = true; } elseif($html == true && $attach == true) { // html and attachments - $content_type = 'multipart/mixed;'; - $content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"'; + $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"'; } $this->headers['Content-Type'] = $content_type; @@ -475,8 +472,7 @@ class ispcmail { if($attach) { foreach($this->attachments as $att) { $this->body .= "--{$this->mime_boundary}\n" . - "Content-Type: " . $att['type'] . ";\n" . - " name=\"" . $att['filename'] . "\"\n" . + "Content-Type: " . $att['type'] . "; name=\"" . $att['filename'] . "\"\n" . "Content-Transfer-Encoding: base64\n" . "Content-Disposition: attachment;\n\n" . chunk_split(base64_encode($att['content'])) . "\n\n"; -- GitLab