【发布时间】:2016-02-22 23:10:03
【问题描述】:
我正在使用 php 从交换邮箱中读取消息。下面只是一个简单的脚本,不是一个真实的例子。
在某些时候,'for' 循环有时会中断,我正在修复这些问题。
如果有 10 条消息并且最后一条的循环中断,则其他 9 条应该被删除的消息将不会被删除,因为没有到达删除的代码中断。
是否有解决方法,即使代码中断,我仍然可以删除已处理删除的正确电子邮件。
//checking how many messages are in the mailbox
$total = imap_num_msg($inbox);
//if there are any messages then process them
if ( $total > 0){
echo "\nAnalysing Mailbox\n";
for ($x=$total; $x>0; $x--){
//doing some work here
delete_processed_message($x);
}
echo "Please wait, expunging old messages\n";
imap_expunge($inbox);
echo "Please wait, disconnecting from mail box\n";
imap_close($inbox);
非常感谢。
【问题讨论】:
标签: php exchange-server imap