$mail = $T->mailStat($i); if (array_key_exists('message_id', $mail)) { $tgt_mail_list[$mail['message_id']] = !empty($mail['subject']) ? $mail['subject'] : "[ No Subject ] Message {$i}"; } } for ($src_idx = $src_path_stat['mail_count']; $src_idx >= 1; $src_idx--) { $stat = $S->mailStat($src_idx); $stat['answered'] = trim($stat['Answered']); $stat['unseen'] = trim($stat['Unseen']); if (empty($stat['subject'])) { $stat['subject'] = "[ No Subject ] Message {$src_idx}"; } if (array_key_exists('message_id', $stat)) { if (array_key_exists($stat['message_id'], $tgt_mail_list)) { echo "S:{$src_idx} Mail: {$stat['subject']}\nT: Already Present\n"; $S->mailWipe($i); continue; } } echo "S:{$src_idx} {$stat['subject']} ({$stat['MailDate']})\n {$src_path_stat['path']} => "; if ($_ENV['fake']) { echo " (FAKED)\n"; continue; } $S->mailGet($src_idx); $opts = array(); if (empty($stat['unseen'])) { $opts[] = '\\Seen'; } if (!empty($stat['answered'])) { $opts[] = '\\Answered';
default: die("Unknown Encoding: {$part['mime-encoding']}\n"); } break; default: die("Unknown Type: {$part['mime-type']}\n"); } } } else { // Just a Single Text Part $wo['note'] = $imap->mailGet($i); } $wo->save(); echo "WO: #{$wo['id']} {$wo['requester']}\n"; // {$wo->note}\n"; $imap->mailWipe($i); } $imap->mailFlush(); exit; function mail_part_list($stat, $depth = null) { if ($depth === null) { $depth = null; } $count = 1; // echo "Depth: $depth\n"; if (empty($stat['parts'])) { return false; } // print_r($stat['parts']); // exit;