- * $message contains all information about the message
- * including header and body
- */
-$message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
-$top_header = $message->header;
+$extracted = false;
+if (isset($extract_message) && $extract_message) {
+ $cmd = "FETCH $passed_id BODY[$passed_ent_id]";
+ $read = sqimap_run_command ($imapConnection, $cmd, true, $response, $message, $uid_support);
+ $cnt = count($read);
+ $body = '';
+ $length = 0;
+ for ($i=1;$i<$cnt;$i++) {
+ $length = $length + strlen($read[$i]);
+ $body .= $read[$i];
+ }
+ if (isset($targetMailbox) && $length>0) {
+ sqimap_append ($imapConnection, $targetMailbox, $length);
+ fputs($imapConnection,$body);
+ sqimap_append_done ($imapConnection);
+ $extracted = true;
+ }
+}