瀏覽代碼

patch adds options that allow setting max size of fetched message body

tokul 22 年之前
父節點
當前提交
6f4ec04ef7
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      functions/mime.php

+ 3 - 1
functions/mime.php

@@ -92,7 +92,7 @@ function mime_structure ($bodystructure, $flags=array()) {
  * to mime_get_elements()
  */
 
-function mime_fetch_body($imap_stream, $id, $ent_id=1) {
+function mime_fetch_body($imap_stream, $id, $ent_id=1, $fetch_size=0) {
     global $uid_support; 
     /* Do a bit of error correction.  If we couldn't find the entity id, just guess
      * that it is the first one.  That is usually the case anyway.
@@ -104,6 +104,8 @@ function mime_fetch_body($imap_stream, $id, $ent_id=1) {
         $cmd = "FETCH $id BODY[$ent_id]";
     }
 
+    if ($fetch_size!=0) $cmd .= "<0.$fetch_size>";
+    
     $data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message, $uid_support);
     do {
         $topline = trim(array_shift($data));