summaryrefslogtreecommitdiff
path: root/program/lib/Mail
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-08-05 13:07:53 +0200
committerAleksander Machniak <alec@alec.pl>2014-08-05 13:07:53 +0200
commite1b8f44e3f635a757d0d13cc2ac908a175593875 (patch)
treea2e00cf989d442d528ce0e10993f846cfa5070f3 /program/lib/Mail
parentcd943ab071ece4b5bb0161f5cf6a6ff1f7144f9d (diff)
Fix invalid Content-Type header when send_format_flowed=false (#1489992)
Diffstat (limited to 'program/lib/Mail')
-rw-r--r--program/lib/Mail/mime.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/program/lib/Mail/mime.php b/program/lib/Mail/mime.php
index 50297dd3e..db0fd1fc2 100644
--- a/program/lib/Mail/mime.php
+++ b/program/lib/Mail/mime.php
@@ -1387,19 +1387,24 @@ class Mail_mime
if ($headers['Content-Type'] == 'text/plain') {
// single-part message: add charset and encoding
- $charset = 'charset=' . $this->_build_params['text_charset'];
- // place charset parameter in the same line, if possible
- // 26 = strlen("Content-Type: text/plain; ")
- $headers['Content-Type']
- .= (strlen($charset) + 26 <= 76) ? "; $charset" : ";$eol $charset";
+ if ($this->_build_params['text_charset']) {
+ $charset = 'charset=' . $this->_build_params['text_charset'];
+ // place charset parameter in the same line, if possible
+ // 26 = strlen("Content-Type: text/plain; ")
+ $headers['Content-Type']
+ .= (strlen($charset) + 26 <= 76) ? "; $charset" : ";$eol $charset";
+ }
+
$headers['Content-Transfer-Encoding']
= $this->_build_params['text_encoding'];
} else if ($headers['Content-Type'] == 'text/html') {
// single-part message: add charset and encoding
- $charset = 'charset=' . $this->_build_params['html_charset'];
- // place charset parameter in the same line, if possible
- $headers['Content-Type']
- .= (strlen($charset) + 25 <= 76) ? "; $charset" : ";$eol $charset";
+ if ($this->_build_params['html_charset']) {
+ $charset = 'charset=' . $this->_build_params['html_charset'];
+ // place charset parameter in the same line, if possible
+ $headers['Content-Type']
+ .= (strlen($charset) + 25 <= 76) ? "; $charset" : ";$eol $charset";
+ }
$headers['Content-Transfer-Encoding']
= $this->_build_params['html_encoding'];
} else {