From 91790e41f3fa307658077043bc2fa5f71e270cf4 Mon Sep 17 00:00:00 2001 From: alecpl Date: Tue, 9 Feb 2010 13:10:12 +0000 Subject: - Fix attachment excessive memory use, support messages of any size (#1484660) --- program/include/rcube_imap.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'program/include/rcube_imap.php') 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) { -- cgit v1.2.3