diff options
Diffstat (limited to 'program/steps/mail')
-rw-r--r-- | program/steps/mail/compose.inc | 10 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/sendmail.inc | 26 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/viewsource.inc | 26 |
5 files changed, 48 insertions, 24 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 71d2197d8..fd3743e2a 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -90,7 +90,11 @@ if (!empty($msg_uid)) // similar as in program/steps/mail/show.inc $MESSAGE = array('UID' => $msg_uid); $MESSAGE['headers'] = &$IMAP->get_headers($msg_uid); - $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid); + $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid); + + if (!empty($MESSAGE['headers']->charset)) + $IMAP->set_charset($MESSAGE['headers']->charset); + $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']); @@ -889,7 +893,7 @@ if ($result = $CONTACTS->list_records()) { while ($sql_arr = $result->iterate()) if ($sql_arr['email']) - $a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name'])); + $a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); } if (isset($CONFIG['ldap_public'])) { @@ -914,7 +918,7 @@ if (isset($CONFIG['ldap_public'])) $email = $results->records[$i]['email']; $name = $results->records[$i]['name']; - $a_contacts[] = format_email_recipient($email, JQ($name)); + $a_contacts[] = format_email_recipient($email, $name); } } $LDAP->close(); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index b1ce4bd4e..79e0248c3 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -695,10 +695,10 @@ function rcmail_print_body($part, $safe=FALSE, $plain=FALSE) $quotation = ''; $q = 0; - if (preg_match('/^(>+\s*)/', $line, $regs)) + if (preg_match('/^(>+\s*)+/', $line, $regs)) { - $q = strlen(preg_replace('/\s/', '', $regs[1])); - $line = substr($line, strlen($regs[1])); + $q = strlen(preg_replace('/\s/', '', $regs[0])); + $line = substr($line, strlen($regs[0])); if ($q > $quote_level) $quotation = str_repeat('<blockquote>', $q - $quote_level); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 21b5b4308..ddd3ea897 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -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); } diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 5cd5e8360..27d26603f 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -30,6 +30,10 @@ if ($_GET['_uid']) $MESSAGE = array('UID' => get_input_value('_uid', RCUBE_INPUT_GET)); $MESSAGE['headers'] = $IMAP->get_headers($MESSAGE['UID']); + // set message charset as default + if (!empty($MESSAGE['headers']->charset)) + $IMAP->set_charset($MESSAGE['headers']->charset); + // go back to list if message not found (wrong UID) if (!$MESSAGE['headers']) { diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc index c88b165b6..7c32b89ca 100644 --- a/program/steps/mail/viewsource.inc +++ b/program/steps/mail/viewsource.inc @@ -5,7 +5,7 @@ | program/steps/mail/viewsource.inc | | | | This file is part of the RoundCube Webmail client | - | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | + | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -22,19 +22,21 @@ // similar code as in program/steps/mail/get.inc if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) - { - header('Content-Type: text/plain'); - //@ob_end_clean(); +{ + $headers = $IMAP->get_headers($uid); + $charset = $headers->charset ? $headers->charset : $IMAP->default_charset; + header("Content-Type: text/plain; charset={$charset}"); $IMAP->print_raw_body($uid); - } +} else - { - raise_error(array('code' => 500, - 'type' => 'php', - 'message' => 'Message UID '.$uid.' not found'), - TRUE, - TRUE); - } +{ + raise_error(array( + 'code' => 500, + 'type' => 'php', + 'message' => 'Message UID '.$uid.' not found'), + true, + true); +} exit; ?> |