php IMAP Mark as read?
Posted: Mon Jun 22, 2009 1:11 am
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hello
I'm using the following code, and I don't know how to mark a message as read after I access it. How can I mark them as read after the program runs?
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hello
I'm using the following code, and I don't know how to mark a message as read after I access it. How can I mark them as read after the program runs?
Code: Select all
$mbox = imap_open("{imap.gmail.com:993/imap/ssl}INBOX", "USERID", "PASSWORD") or die("can't connect: " . imap_last_error());
$mc = imap_check($mbox);
$result = imap_fetch_overview($mbox,"1:{$mc->Nmsgs}",0);
foreach ($result as $overview)
{
$seen_msg = $overview->seen;
if (!$seen_msg)
{
echo "{$overview->msgno}\n({$overview->date})\nFrom:{$overview->from}\n{$overview->subject}";
echo "UID: {$overview->uid}";
echo "Seen: {$overview->seen}";
$msgbody = imap_fetchbody($mbox,$overview->msgno,1);
echo "Message: $msgbody";
}
}
imap_close($mbox);
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: