Patches for Roundcube Mail

See http://roundcube.net for information on roundcube.

Attachments in memory

roundcubemail-0.1.attach.patch
roundcubemail-0.1.1.attach.patch

This patch addresses several instances where the entire message is stored in memory (attachments included).

The mime object is changed so that attachment parts are stored as arrays:
array( "file", 'file_name' => $file_name, 'filesize' => $filesize );

When the message is serialized with the get() or getMessage() methods the body part of the message is an array which contains strings and/or arrays representing files as above.

The files are not opened until needed. 4kb buffers are used to keep memory usage low.

This change required updates to the SMTP and IMAP classes for sending and storing messages. Changes were also made to the code for composing a message from a draft with attachmentns or for forwarding a message with attachments.

A function for users without an SMTP server was added as a replacement for PHP's mail() function. This function uses proc_open() to open sendmail and write the message to the MTA's stdin in 4kb buffers. Use of PHP's mail() function required that the entire message be stored in memory and passed as string. It seems like PHP's mail() function was meant for small quick messages - not emails that are handled with a web-based email client. I'm not sure how this will affect non-unix platforms, but the code is only used if your PHP's sendmail_path is similar to '/usr/sbin/sendmail '. If not then setup a smtp server in your config or you will have to live with messages entirely in memory.

There is still a problem with messages with large text attachments. Roundcube will read the entire message into memory to display it inline through the interface.