Skip to content
Snippets Groups Projects
Commit 5a86c344 authored by Marius Burkard's avatar Marius Burkard
Browse files

- fixed mail content-type / charset and boundary problem

parent 2c76595c
No related branches found
No related tags found
No related merge requests found
...@@ -433,20 +433,17 @@ class ispcmail { ...@@ -433,20 +433,17 @@ class ispcmail {
$textonly = true; $textonly = true;
} elseif($text == true && $html == false && $attach == true) { } elseif($text == true && $html == false && $attach == true) {
// text and attachment // text and attachment
$content_type = 'multipart/mixed;'; $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} elseif($html == true && $text == true && $attach == false) { } elseif($html == true && $text == true && $attach == false) {
// html only (or text too) // html only (or text too)
$content_type = 'multipart/alternative;'; $content_type = 'multipart/alternative; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} elseif($html == true && $text == false && $attach == false) { } elseif($html == true && $text == false && $attach == false) {
// html only (or text too) // html only (or text too)
$content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
$htmlonly = true; $htmlonly = true;
} elseif($html == true && $attach == true) { } elseif($html == true && $attach == true) {
// html and attachments // html and attachments
$content_type = 'multipart/mixed;'; $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} }
$this->headers['Content-Type'] = $content_type; $this->headers['Content-Type'] = $content_type;
...@@ -475,8 +472,7 @@ class ispcmail { ...@@ -475,8 +472,7 @@ class ispcmail {
if($attach) { if($attach) {
foreach($this->attachments as $att) { foreach($this->attachments as $att) {
$this->body .= "--{$this->mime_boundary}\n" . $this->body .= "--{$this->mime_boundary}\n" .
"Content-Type: " . $att['type'] . ";\n" . "Content-Type: " . $att['type'] . "; name=\"" . $att['filename'] . "\"\n" .
" name=\"" . $att['filename'] . "\"\n" .
"Content-Transfer-Encoding: base64\n" . "Content-Transfer-Encoding: base64\n" .
"Content-Disposition: attachment;\n\n" . "Content-Disposition: attachment;\n\n" .
chunk_split(base64_encode($att['content'])) . "\n\n"; chunk_split(base64_encode($att['content'])) . "\n\n";
......
...@@ -433,20 +433,17 @@ class ispcmail { ...@@ -433,20 +433,17 @@ class ispcmail {
$textonly = true; $textonly = true;
} elseif($text == true && $html == false && $attach == true) { } elseif($text == true && $html == false && $attach == true) {
// text and attachment // text and attachment
$content_type = 'multipart/mixed;'; $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} elseif($html == true && $text == true && $attach == false) { } elseif($html == true && $text == true && $attach == false) {
// html only (or text too) // html only (or text too)
$content_type = 'multipart/alternative;'; $content_type = 'multipart/alternative; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} elseif($html == true && $text == false && $attach == false) { } elseif($html == true && $text == false && $attach == false) {
// html only (or text too) // html only (or text too)
$content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"'; $content_type = 'text/html; charset="' . strtolower($this->mail_charset) . '"';
$htmlonly = true; $htmlonly = true;
} elseif($html == true && $attach == true) { } elseif($html == true && $attach == true) {
// html and attachments // html and attachments
$content_type = 'multipart/mixed;'; $content_type = 'multipart/mixed; boundary="' . $this->mime_boundary . '"';
$content_type .= "\n" . ' boundary="' . $this->mime_boundary . '"';
} }
$this->headers['Content-Type'] = $content_type; $this->headers['Content-Type'] = $content_type;
...@@ -475,8 +472,7 @@ class ispcmail { ...@@ -475,8 +472,7 @@ class ispcmail {
if($attach) { if($attach) {
foreach($this->attachments as $att) { foreach($this->attachments as $att) {
$this->body .= "--{$this->mime_boundary}\n" . $this->body .= "--{$this->mime_boundary}\n" .
"Content-Type: " . $att['type'] . ";\n" . "Content-Type: " . $att['type'] . "; name=\"" . $att['filename'] . "\"\n" .
" name=\"" . $att['filename'] . "\"\n" .
"Content-Transfer-Encoding: base64\n" . "Content-Transfer-Encoding: base64\n" .
"Content-Disposition: attachment;\n\n" . "Content-Disposition: attachment;\n\n" .
chunk_split(base64_encode($att['content'])) . "\n\n"; chunk_split(base64_encode($att['content'])) . "\n\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment