Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. imap_search problem

imap_search problem

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpdata-structures
13 Posts 5 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Niall Barr

    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';
    ?>

    N Offline
    N Offline
    nathionice
    wrote on last edited by
    #3

    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

    N 1 Reply Last reply
    0
    • N nathionice

      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

      N Offline
      N Offline
      Niall Barr
      wrote on last edited by
      #4

      I'm afraid I don't know much about IMAP servers, so can't help there. Niall

      N 1 Reply Last reply
      0
      • N Niall Barr

        I'm afraid I don't know much about IMAP servers, so can't help there. Niall

        N Offline
        N Offline
        nathionice
        wrote on last edited by
        #5

        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");

        N 1 Reply Last reply
        0
        • N nathionice

          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");

          N Offline
          N Offline
          Niall Barr
          wrote on last edited by
          #6

          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.

          1 Reply Last reply
          0
          • N 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. $result = imap_search($imap,'UNSEEN'); foreach ($result as $value) { echo " the unseen message number is"; echo "
            "; echo $value; echo "
            "; }

            E Offline
            E Offline
            elizas
            wrote on last edited by
            #7

            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.

            S M 3 Replies Last reply
            0
            • E elizas

              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.

              S Offline
              S Offline
              sarahcolin1
              wrote on last edited by
              #8

              Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale

              E M 2 Replies Last reply
              0
              • S sarahcolin1

                Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale

                E Offline
                E Offline
                elizas
                wrote on last edited by
                #9

                Thanks.You are Welcome.:)

                Cheers, Eliza Mindfire: India's Only Company to be both Apple Premier & Microsoft Gold certified.

                1 Reply Last reply
                0
                • E elizas

                  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.

                  M Offline
                  M Offline
                  Mari Jenkins
                  wrote on last edited by
                  #10

                  Exactly what I was looking for! Thank you so much for the info, you're the best. Make Money On The Internet

                  E 1 Reply Last reply
                  0
                  • M Mari Jenkins

                    Exactly what I was looking for! Thank you so much for the info, you're the best. Make Money On The Internet

                    E Offline
                    E Offline
                    elizas
                    wrote on last edited by
                    #11

                    You are Welcome!!

                    Cheers, Eliza

                    1 Reply Last reply
                    0
                    • S sarahcolin1

                      Thank you for providing this link. I am sure it will help me in the future. Chapel Hill Houses for Sale

                      M Offline
                      M Offline
                      Mari Jenkins
                      wrote on last edited by
                      #12

                      I also found it very informative. Thanks again. Deficiency Judgment :-D

                      1 Reply Last reply
                      0
                      • E elizas

                        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.

                        M Offline
                        M Offline
                        Mari Jenkins
                        wrote on last edited by
                        #13

                        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

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups