diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-02-09 13:10:12 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-02-09 13:10:12 +0000 |
| commit | 7d6aefc45cb269b327f058bea54bf1136cf95b00 (patch) | |
| tree | 95006358696d8e68263431c35f6c31eff94a8148 /roundcubemail/program/lib | |
| parent | e9fdb4bae6ee01bae196782932b43caa65e8f48f (diff) | |
- Fix attachment excessive memory use, support messages of any size (#1484660)
git-svn-id: https://svn.roundcube.net/trunk@3261 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/lib')
| -rw-r--r-- | roundcubemail/program/lib/imap.inc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/roundcubemail/program/lib/imap.inc b/roundcubemail/program/lib/imap.inc index 7607a1c71..ed30937fa 100644 --- a/roundcubemail/program/lib/imap.inc +++ b/roundcubemail/program/lib/imap.inc @@ -2418,7 +2418,7 @@ function iil_C_Append(&$conn, $folder, &$message) { return false; } -function iil_C_AppendFromFile(&$conn, $folder, $path) { +function iil_C_AppendFromFile(&$conn, $folder, $path, $headers=null, $separator="\n\n") { if (!$folder) { return false; } @@ -2438,7 +2438,12 @@ function iil_C_AppendFromFile(&$conn, $folder, $path) { if (!$len) { return false; } - + + if ($headers) { + $headers = preg_replace('/[\r\n]+$/', '', $headers); + $len += strlen($headers) + strlen($separator); + } + //send APPEND command $request = 'a APPEND "' . iil_Escape($folder) . '" (\\Seen) {' . $len . '}'; if (iil_PutLine($fp, $request)) { @@ -2450,16 +2455,21 @@ function iil_C_AppendFromFile(&$conn, $folder, $path) { return false; } - //send file + // send headers with body separator + if ($headers) { + iil_PutLine($fp, $headers . $separator, false); + } + + // send file while (!feof($in_fp)) { - $buffer = fgets($in_fp, 4096); + $buffer = fgets($in_fp, 4096); iil_PutLine($fp, $buffer, false); } fclose($in_fp); iil_PutLine($fp, ''); // \r\n - //read response + // read response do { $line = iil_ReadLine($fp); } while (!iil_StartsWith($line, 'a ', true)); |
