简体   繁体   English

php imap 是否可以通过 email id stackoverflow 删除 1 email

[英]php imap is it possible to delete 1 email by email id stackoverflow

is it possible to perform imap php function with a given UID??是否可以使用给定的 UID 执行 imap php function?

because when we do因为当我们这样做时

$imapx__ressource = imap_open($imapx__server, $imapx__user, $imapx__password);
$imapx__emails = imap_search($imapx__ressource, $imapx__search);
foreach($imapx__emails as $imapx__email){
     $imapx_headerinfos = imap_headerinfo($imapx__ressource, $imapx__email);
}

the $imapx_headerinfos will have UID (email ID) $imapx_headerinfos 将具有 UID(电子邮件 ID)

but what about the inverse?但反过来呢?

I have the UID of a given email, I want to read or delete that specific email.我有给定 email 的 UID,我想读取或删除该特定 email。

Thanks谢谢

Here the working solution这里的工作解决方案

When retrieving the emails don't forget to save in DB检索电子邮件时不要忘记保存在数据库中

imap_uid($imapx__ressource, $imapx__email)

** NB: the headerinfos->message_id is NOT the same as UID... ** 注意:headerinfos->message_id 与 UID 不同...

$imapx__ressource = imap_open($imapx__server, $imapx__user, $imapx__password);
imap_delete($imapx__ressource, $email_UID, FT_UID);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM