我正在使用PHP函数imap_open
每封电子邮件的循环完成后,如何将其移动或复制到特定文件夹然后将其删除?
这是我的代码:
//try to connect
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect: ' . imap_last_error());
//grab emails
$emails = imap_search($inbox,'ALL');
//if emails are returned, cycle through each...
if($emails) {
//begin output var
$output = '';
//put the newest emails on top
rsort($emails);
//for every email...
foreach($emails as $email_number) {
//run queries etc here
}
}
目前我只是使用以下方式删除电子邮件:
//delete the email
//this deletes the email
imap_delete($inbox,1);
//this bit really really deletes the email
imap_expunge($inbox);