if (!$uids) { echo '邮箱' . $ac['gmail'] . "是空的(︶︿︶)\r\n"; echo $ac['gmail'] . " 连接断开\r\n"; $mail->closeMail(); continue; } else { echo '邮箱' . $ac['gmail'] . "有新邮件耶!<( ̄︶ ̄)>\r\n"; } $msgcount = count($uids); echo "邮箱邮件数:{$msgcount}\r\n"; $now = time(); //$lastEmailSendLime = $msg_obj->getLastSendTime($ac['gmail']); $lasttime = ''; for ($i = $msgcount - 1; $i >= 0; $i--) { $msgno = imap_msgno($connect, $uids[$i]); $headinfo = $mail->getHeader($msgno); $header = imap_headerinfo($connect, $msgno); if (!$header) { continue; } /* if($headinfo['date']<$lastEmailSendLime){ continue; } */ /* if($now - strtotime($headinfo['date']) > 7200){ echo "过滤$uids[$i]\r\n"; break; } */ $pattern_forbidden = '/seller-notification|do-not-reply|' . 'haendler-benachrichtigungen|fba-ship-confirm|' . 'nobody|auto-communication/'; if (preg_match($pattern_forbidden, $headinfo['from'])) { echo '过滤' . $headinfo['from'] . "\n";