imap_search problem
-
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. $result = imap_search($imap,'UNSEEN'); foreach ($result as $value) { echo " the unseen message number is"; echo "
"; echo $value; echo "
"; }Your code looks OK - could it be something strange about the server configuration? I just tried this code to get IMAP unread numbers from our exchange server and it worked fine.
<?php
$himap = imap_open ('{some.server.ac.uk:143}INBOX', 'username', 'password');$result = imap_search ($himap, 'UNSEEN');
if(is_array($result))
{
foreach ($result as $value)
{
echo "Unseen message number $value<br/>";
}
}
else
echo 'No unseen messages';
?> -
Your code looks OK - could it be something strange about the server configuration? I just tried this code to get IMAP unread numbers from our exchange server and it worked fine.
<?php
$himap = imap_open ('{some.server.ac.uk:143}INBOX', 'username', 'password');$result = imap_search ($himap, 'UNSEEN');
if(is_array($result))
{
foreach ($result as $value)
{
echo "Unseen message number $value<br/>";
}
}
else
echo 'No unseen messages';
?>Thanks for the help Niall. I tried yours as well it returned all the messages. In case you might have an idea, what possible server configuration could be causing this. Regards Nath
-
Thanks for the help Niall. I tried yours as well it returned all the messages. In case you might have an idea, what possible server configuration could be causing this. Regards Nath
I'm afraid I don't know much about IMAP servers, so can't help there. Niall
-
I'm afraid I don't know much about IMAP servers, so can't help there. Niall
Could there problem be because I am using pop3 driver to access the emails. I am using the code below: $MAILSRV="mail.somewhere.com:110/pop3/notls"; $imap = imap_open ("{".$MAILSRV."}INBOX", "someemail@somewhere.com", "password");
-
Could there problem be because I am using pop3 driver to access the emails. I am using the code below: $MAILSRV="mail.somewhere.com:110/pop3/notls"; $imap = imap_open ("{".$MAILSRV."}INBOX", "someemail@somewhere.com", "password");
I'm surprised that works at all - POP3 and IMAP are quite different. I don't think a POP3 server keeps any information on which messages are read however, so unless you have IMAP mailboxes configured on the server you will just get a list of all messages.
-
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. $result = imap_search($imap,'UNSEEN'); foreach ($result as $value) { echo " the unseen message number is"; echo "
"; echo $value; echo "
"; }hi, I am a non-technical person.A software developer of my company (Mindfire Solutions) has designed a tips section relating to PHP. There various tips are provided.U can go through them and have a look.It will solve your problem. http://www.mindfiresolutions.com/PHP-85.php[^]
Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
-
hi, I am a non-technical person.A software developer of my company (Mindfire Solutions) has designed a tips section relating to PHP. There various tips are provided.U can go through them and have a look.It will solve your problem. http://www.mindfiresolutions.com/PHP-85.php[^]
Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale
-
Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale
-
hi, I am a non-technical person.A software developer of my company (Mindfire Solutions) has designed a tips section relating to PHP. There various tips are provided.U can go through them and have a look.It will solve your problem. http://www.mindfiresolutions.com/PHP-85.php[^]
Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
Exactly what I was looking for! Thank you so much for the info, you're the best. Make Money On The Internet
-
Exactly what I was looking for! Thank you so much for the info, you're the best. Make Money On The Internet
-
Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale
I also found it very informative. Thanks again. Deficiency Judgment :-D
-
hi, I am a non-technical person.A software developer of my company (Mindfire Solutions) has designed a tips section relating to PHP. There various tips are provided.U can go through them and have a look.It will solve your problem. http://www.mindfiresolutions.com/PHP-85.php[^]
Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.
I am working with Wordpress right now and it is written in PHP. Let me tell you that your information is just what I was looking for. It is quite intimidating at first, but you present the information in a way that is truly easy to follow. Thank you so much for this. I am learning so much. Deficiency Judgment