IMAP电子邮件标识符在PHP中是唯一的吗?

IMAP电子邮件标识符在PHP中是唯一的吗?,php,email,gmail,imap,gmail-imap,Php,Email,Gmail,Imap,Gmail Imap,我的目标是能够使用表单、复选框和提交按钮(删除按钮)删除特定的电子邮件 我从以下连接脚本开始: <?php //Inbox - Connect; $inbox = imap_open($folder_inbox,$username,$password) or die('Error connecting to Gmail: ' . imap_last_error()); //Grab Inbox Emails; $inbox_emails = imap_search($inbox,'AL

我的目标是能够使用表单、复选框和提交按钮(删除按钮)删除特定的电子邮件

我从以下连接脚本开始:

<?php

//Inbox - Connect;
$inbox = imap_open($folder_inbox,$username,$password) or die('Error connecting to Gmail: ' . imap_last_error());

//Grab Inbox Emails;
$inbox_emails = imap_search($inbox,'ALL');

//If there are emails;
if($inbox_emails) {

    //Output Arrays;
    $inbox_from = array();
    $inbox_subject = array();
    $inbox_date = array();
    $inbox_msg = array();

    //Put the newest emails to the top;
    rsort($inbox_emails);

    //For each email, Give it an email number;
    foreach($inbox_emails as $inbox_email_number) {

        //Get information specific to this email;
        $inbox_overview = imap_fetch_overview($inbox,$inbox_email_number,0);

        $str_date = $inbox_overview[0]->date;
        include('../func/inbox/grab/datefix.php');

        mb_internal_encoding('UTF-8');

        //Add email information to the arrays;
        $inbox_read[] = $inbox_overview[0]->seen;
        $inbox_from[] = str_replace('"',"", str_replace("_"," ", mb_decode_mimeheader($inbox_overview[0]->from)));
        $inbox_subject[] = str_replace("_"," ", mb_decode_mimeheader($inbox_overview[0]->subject));
        $inbox_date[] = $str_date;
        //$inbox_msg[] = imap_fetchbody($inbox,$inbox_email_number,2);

    }

} 

//Close The Connection;
imap_close($inbox);

?>

我知道,但我担心在获取文件夹的一组ID和几分钟后请求删除其中一个项目之间可能存在竞争条件


例如,我的表单显示2个电子邮件主题,我单击与id为“1”的电子邮件1相关的复选框,然后单击提交表单的删除按钮。该复选框将具有
name=“1”
参数。现在,当我们提交表单时,让我们在提交页面上说,它使用post获得id 1,但让我们说,在我们加载PHP文件之前,我收到了一封新的电子邮件,它不会错误地删除新的电子邮件,而不是我们检查的电子邮件吗?

您想要的功能是
imap\u delete()
我明白,但我该如何删除特定的电子邮件?将msg_号码作为第二个参数。哦,好吧,但我该如何获得消息号码?它有IMAP标题吗?Gmail删除消息很奇怪。具体来说,删除电子邮件会从邮件中删除当前标签。它将继续存在于所有邮件中。如果你想“删除”一条消息,你需要把它移到垃圾箱,然后从那里删除它。