&引用;OnClick";在'';IMAP到PHP页面'';

&引用;OnClick";在'';IMAP到PHP页面'';,php,ajax,Php,Ajax,一切正常,但我还需要一个功能。在每封新邮件中,在同一行中,我需要按钮“所有者”,所以当用户在该字段中输入他的广告时,该字段将被锁定,以便任何人都可以知道谁拥有哪封邮件 /* connect to gmail */ $hostname = '{imap.gmail.com:993/imap/ssl}INBOX'; $username = 'X'; $password = 'X'; /* try to connect */ $inbox = imap_open($hostname,$username

一切正常,但我还需要一个功能。在每封新邮件中,在同一行中,我需要按钮“所有者”,所以当用户在该字段中输入他的广告时,该字段将被锁定,以便任何人都可以知道谁拥有哪封邮件

/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'X';
$password = 'X';
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . 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) {                
                /* get information specific to this email */
                $overview = imap_fetch_overview($inbox,$email_number,0);
                $message = imap_fetchbody($inbox,$email_number,2);                
                /* output the email header information */
                $output.= '<div class="toggler '.($overview[0]->seen ? 'read' : 'unread').'">';
                $output.= '<span class="subject">'.$overview[0]->subject.'</span> ';
                $output.= '<span class="from">'.$overview[0]->from.'</span>';
                $output.= '</div>';

        }        
        echo $test , $test , $output;
}
imap_close($inbox);
/*连接到gmail*/
$hostname='{imap.gmail.com:993/imap/ssl}收件箱';
$username='X';
$password='X';
/*尝试连接*/
$inbox=imap_open($hostname,$username,$password)或die('cannotconnecttogmail:'。imap_last_error());
/*抓取电子邮件*/
$emails=imap_搜索($inbox,'ALL');
/*如果电子邮件被返回,请循环浏览每个*/
如果($电子邮件){
/*开始输出变量*/
$output='';
/*把最新的电子邮件放在最上面*/
rsort(电子邮件);
/*对于每封电子邮件*/
foreach($email作为$email_编号){
/*获取此电子邮件的特定信息*/
$overview=imap\U fetch\U overview($inbox,$email\u number,0);
$message=imap\u fetchbody($inbox,$email\u number,2);
/*输出电子邮件标题信息*/
$output.='';
$output.=''.$overview[0]->subject';
$output.=''.$overview[0]->from';
$output.='';
}        
echo$test,$test,$output;
}
imap_关闭($收件箱);

不太清楚您想要什么。“拥有哪封邮件”是什么意思?谁是谁?现在你只能抓取电子邮件并显示它们。没有用户。有没有数据库/存储?假设你和我一起工作,但我们不在同一个房间(所以我们不能交谈),电子邮件就到了。当电子邮件到达时,我们不能同时回复同一封邮件,我们必须将它们分开,你要一封,我要另一封。我们可以做到这一点,如果在该页面上的每封抓取的邮件上都显示空字段“user”,我可以在其中放置我的广告,您也可以放置您的广告,这样我们就可以知道谁将回复哪封邮件。