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"); } if ($_ENV['once']) { die("--one and done\n"); } } } class IMAP { private $_c; // Connection Handle private $_c_host;