summaryrefslogtreecommitdiff
path: root/program/include/rcube_imap.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-02-09 13:10:12 +0000
committeralecpl <alec@alec.pl>2010-02-09 13:10:12 +0000
commit91790e41f3fa307658077043bc2fa5f71e270cf4 (patch)
tree9864a79c0524eb064c2d07b78180394d5d9c9adf /program/include/rcube_imap.php
parent5c54cc0ee6de44960bbc4cfab3d456a4805a0692 (diff)
- Fix attachment excessive memory use, support messages of any size (#1484660)
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r--program/include/rcube_imap.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 6ab0b6a88..ecde6f958 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1699,17 +1699,27 @@ class rcube_imap
/**
* Append a mail message (source) to a specific mailbox
*
- * @param string Target mailbox
- * @param string Message source
+ * @param string Target mailbox
+ * @param string The message source string or filename
+ * @param string Headers string if $message contains only the body
+ * @param boolean True if $message is a filename
+ *
* @return boolean True on success, False on error
*/
- function save_message($mbox_name, &$message)
+ function save_message($mbox_name, &$message, $headers='', $is_file=false)
{
$mailbox = $this->mod_mailbox($mbox_name);
// make sure mailbox exists
- if (($mailbox == 'INBOX') || in_array($mailbox, $this->_list_mailboxes()))
- $saved = iil_C_Append($this->conn, $mailbox, $message);
+ if (($mailbox == 'INBOX') || in_array($mailbox, $this->_list_mailboxes())) {
+ if ($is_file) {
+ $separator = rcmail::get_instance()->config->header_delimiter();
+ $saved = iil_C_AppendFromFile($this->conn, $mailbox, $message,
+ $headers, $separator.$separator);
+ }
+ else
+ $saved = iil_C_Append($this->conn, $mailbox, $message);
+ }
if ($saved)
{