Hi,

i've been searching online for a tutorial that would allow me to receving email using php and parse the data, unfortunately i haven't found much.

I would deeply appreciate tips/pointers (where to look for more info), on checking pop3/imap mail using php. I don't know much on the subject so i can't really elaborate, but one of the most important things I need to knwo is how to connect to a external mail server.

Thanks.

Update : I came across this while i was serachign online : http://www.php-library.com/pear_man/package.networking.net-pop3.intro.html

Do you guys think that will do the job? I was also wondering what to put for the server field ie: on the sample script it says 'localhost', but lets say i need to connect to gmail, would i put pop3.gmail.com?

thanks again

    I don't beleive you can connect to gmail that way - it needs to be something local (on your server). I think, but I could be wrong.

    I was going to recommend the Pear option...if it doesn't do the trick it will certainly give you some ideas on how to pull it off on your own.

      I have connected to an external mail server with the imap controls...

      Its tricky...

      This just checks the amount of mails on my pop.ntlworld.com account.

      <?
               //check for new messages
      
           $mailbox = @imap_open("{pop.ntlworld.com/pop3:110}INBOX",
                   "login","password");
      
           // Check messages
      $check = @imap_check($mailbox);
      
      if(!$check) { $num = "Error";}
      else {
      	    $num = $check->Nmsgs;
              }
              echo 'Number of emails:' . $num;
               @imap_close($mailbox);
      ?>

      Although gmail uses authentication and a different port number, so it may be more tricky. You should look in the manual http://uk2.php.net/imap

        Thanks alot! I've been reading on the info you guys provided, and I think i've found a way to make it work (using the imap functions madwormer2 pointed out). I'll post back once i've had a chance to test out the code.

        Thanks alot!

          Write a Reply...