X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fsteps%2Fmail%2Fsendmail.inc;fp=program%2Fsteps%2Fmail%2Fsendmail.inc;h=f5168dd6f118a894516403abede4ecc54d420ba7;hb=c55c762910acc6b77b1aab2b6e28d5bbf522b920;hp=12dd18a6ceddba4e9358d5f67246fe96d5df174b;hpb=d326b0c67bb536d2296004c927e89ab8c4a548b5;p=roundcube.git diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 12dd18a..f5168dd 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -16,7 +16,7 @@ | Author: Thomas Bruederli | +-----------------------------------------------------------------------+ - $Id: sendmail.inc 1120 2008-02-19 23:59:38Z thomasb $ + $Id: sendmail.inc 1255 2008-04-05 12:49:21Z thomasb $ */ @@ -212,12 +212,16 @@ if (!empty($_POST['_receipt'])) // additional headers $headers['Message-ID'] = $message_id; $headers['X-Sender'] = $from; -$headers['Received'] = wordwrap('from ' . - (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? - gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']).' ['.$_SERVER['HTTP_X_FORWARDED_FOR'].'] via ' : '') . - gethostbyaddr($_SERVER['REMOTE_ADDR']).' ['.$_SERVER['REMOTE_ADDR'].'] with ' . - $_SERVER['SERVER_PROTOCOL'].' ('.$_SERVER['REQUEST_METHOD'].'); ' . date('r'), - 69, rcmail_header_delm() . "\t"); + +if ($CONFIG['http_received_header']) +{ + $nldlm = rcmail_header_delm() . "\t"; + $headers['Received'] = wordwrap('from ' . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? + gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']).' ['.$_SERVER['HTTP_X_FORWARDED_FOR'].']'.$nldlm.' via ' : '') . + gethostbyaddr($_SERVER['REMOTE_ADDR']).' ['.$_SERVER['REMOTE_ADDR'].']'.$nldlm.'with ' . + $_SERVER['SERVER_PROTOCOL'].' ('.$_SERVER['REQUEST_METHOD'].'); ' . date('r'), + 69, $nldlm); +} if (!empty($CONFIG['useragent'])) $headers['User-Agent'] = $CONFIG['useragent']; @@ -245,6 +249,11 @@ if ($isHtml) // add a plain text version of the e-mail as an alternative part. $h2t = new html2text($message_body); $plainTextPart = wordwrap($h2t->get_text(), 998, "\r\n", true); + if (!strlen($plainTextPart)) + { + // empty message body breaks attachment handling in drafts + $plainTextPart = "\r\n"; + } $MAIL_MIME->setTXTBody(html_entity_decode($plainTextPart, ENT_COMPAT, 'utf-8')); // look for "emoticon" images from TinyMCE and copy into message as attachments @@ -254,6 +263,11 @@ else { $message_body = wordwrap($message_body, 75, "\r\n"); $message_body = wordwrap($message_body, 998, "\r\n", true); + if (!strlen($message_body)) + { + // empty message body breaks attachment handling in drafts + $message_body = "\r\n"; + } $MAIL_MIME->setTXTBody($message_body, FALSE, TRUE); }