Home > Backend Development > PHP Tutorial > IMap获取信件内容如何筛选邮件?哪位高手做过?请问了

IMap获取信件内容如何筛选邮件?哪位高手做过?请问了

WBOY
Release: 2016-06-13 12:56:37
Original
1367 people have browsed it

IMap获取信件内容怎么筛选邮件??谁做过?请教了

<?php<br />
<br />
require_once('../ImapMailbox.php');<br />
<br />
// IMAP must be enabled in Google Mail Settings<br />
define('GMAIL_EMAIL', '');<br />
define('GMAIL_PASSWORD', '');<br />
define('ATTACHMENTS_DIR', dirname(__FILE__) . '/attachments');<br />
<br />
$mailbox = new ImapMailbox('{xxxx/notls}INBOX', GMAIL_EMAIL, GMAIL_PASSWORD, ATTACHMENTS_DIR, 'utf-8');<br />
$mails = array();<br />
<br />
foreach($mailbox->searchMails('ALL') as $mailId) {<br />
	$mail = $mailbox->getMail($mailId);<br />
	// $mailbox->setMailAsSeen($mail->mId);<br />
	// $mailbox->deleteMail($mail->mId);<br />
	$mails[] = $mail;<br />
}<br />
echo "<pre class="brush:php;toolbar:false">";<br />
var_dump($mails);
Copy after login



关键是这里 foreach($mailbox->searchMails('ALL') as $mailId) {

这个参数ALL,可以换成其他的吗

不然邮箱里有10万封信,要找10万次,而我只要找前1个小时的


------解决方案--------------------
哇靠,刚进来就结贴了,结贴需要个拿分的人  
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template