imap_search returns both read and unread messages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nathionice
Forum Newbie
Posts: 1
Joined: Tue Jan 12, 2010 3:55 am

imap_search returns both read and unread messages

Post by nathionice »

I am using the imap_search function to return an array of unseen messages but all the messages are returned. I only want to show unread messages but the code returns all the messages (numbers) in the mailbox.

Thanks in advance for your help.

Below is the code.

Code: Select all

$result = imap_search($imap,'UNSEEN');
 
foreach ($result as $value) {
 
echo " the unseen message number is";
echo "<br>";
echo $value;
echo "<br>";
}
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: imap_search returns both read and unread messages

Post by Christopher »

What do you get if you use SEEN?
(#10850)
Post Reply