コード例 #1
0
 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';
 }
 $opts = implode(' ', $opts);
 $date = strftime('%d-%b-%Y %H:%M:%S +0000', strtotime($stat['MailDate']));
 if ($res = $T->mailPut(file_get_contents('mail'), $opts, $date)) {
     $S->mailWipe($src_idx);
     echo "{$tgt_path_stat['path']}\n";
 } else {
     die("Fail to Put {$res}\n");
 }
コード例 #2
0
 $wo['contact_id'] = $c['id'];
 $wo['requester'] = trim($from->personal);
 $wo['note'] = $stat['subject'] . "\n";
 $part_list = mail_part_list($stat);
 if ($part_list) {
     foreach ($part_list as $mime_id => $part) {
         echo "Mime Part: {$mime_id}\n";
         switch ($part['mime-type']) {
             case 'text/html':
                 // @todo Attach to WO?
                 echo "Unhandled HTML Part\n";
                 break;
             case 'text/plain':
                 switch ($part['mime-encoding']) {
                     case '7bit':
                         $wo->note .= $imap->mailGet($i, $mime_id);
                         break;
                     case 'quoted-printable':
                         $x = $imap->mailGet($i, $mime_id);
                         $wo->note .= quoted_printable_decode($x);
                         break;
                     default:
                         die("Unknown Encoding: {$part['mime-encoding']}\n");
                 }
                 break;
             default:
                 die("Unknown Type: {$part['mime-type']}\n");
         }
     }
 } else {
     // Just a Single Text Part