+ Reply to Thread
Results 1 to 8 of 8

Thread: Reading E-Mail using imap in PHP

  1. #1
    Affix is offline Learning Programmer
    Join Date
    Feb 2009
    Location
    Scotland
    Posts
    47
    Blog Entries
    2
    Rep Power
    12

    Reading E-Mail using imap in PHP

    IMAP functions of PHP allow Communication with IMAP and POP3 Services trhough the PHP Enabled Webserver.

    To use imap you must start your imap session using the imap_open() it is best to do this in a Variable so you dont leav an pen session.

    Code:
    $mailbox = imap_open ("{localhost:110/pop3}INBOX", "user", "pass");
    we now have a Stream to a pop3 server running on localhost(The host of the script).

    What if we want to read the stream.

    Reading an IMAP stream is fairly simple as long as you know the basic pre-defined variables for doing so.

    Why dont we check for some new email?

    Ok then define a variable i will call $checker you name it what you want. Add the following code to your variable

    Code:
    $checker = imap_check($mailbox);
    Notice our mailbox has cropped up again the imap_check function will check using other variables linked to this.

    For example
    Code:
    Total Number of Messages : <?= $checker->Nmsgs ?>
    Name of Mailbox : <?= $checker->mailbox ?>
    Note that this is 100% Correct Syntax

    Those are 2 basic examples of how to check the mailserver Here are a list of all the different Variable Types for imap_check()

    Code:
    Date :: Get the Date of last received message
    Driver :: Show the Connection Type
    Mailbox :: Display Mailbox Name
    Nmsgs :: Total Messages
    Recent :: Number of recent messages
    Well this is the Basic IMAP check Function of PHP I will soon post a tutorial for IMAP headers also.

    Thanks for reading,
    Affix

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: Reading E-Mail using imap in PHP

    Very nice tutorial. +rep

  4. #3
    Affix is offline Learning Programmer
    Join Date
    Feb 2009
    Location
    Scotland
    Posts
    47
    Blog Entries
    2
    Rep Power
    12

    Re: Reading E-Mail using imap in PHP

    Thanks for your comments

    I will write some more

  5. #4
    ReekenX's Avatar
    ReekenX is offline Programmer
    Join Date
    Jan 2007
    Location
    Lithuania
    Posts
    135
    Rep Power
    0

    Re: Reading E-Mail using imap in PHP

    +rep

  6. #5
    Affix is offline Learning Programmer
    Join Date
    Feb 2009
    Location
    Scotland
    Posts
    47
    Blog Entries
    2
    Rep Power
    12

    Re: Reading E-Mail using imap in PHP

    you can use this with a catchall address and create your own E-Mail Provider

    Just thaught I would throw that in there

    Thats why I learned to do it lol gave up on the project though was taking up too much time

  7. #6
    Join Date
    Sep 2008
    Location
    Australia
    Posts
    4,834
    Blog Entries
    10
    Rep Power
    51

    Re: Reading E-Mail using imap in PHP

    Hmmm interesting. I never knew PHP had an area for this, really amazing. +rep
    jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation
    Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!

  8. #7
    tecktalk is offline Programmer
    Join Date
    May 2008
    Posts
    179
    Rep Power
    0

    Re: Reading E-Mail using imap in PHP

    Yes.. I was finding this one.. was a bit confused how to do.. Thanks for sharing with us.. +rep from me too
    _______________________
    gadgets
    women for tedisco

  9. #8
    phpforfun's Avatar
    phpforfun is offline Speaks fluent binary
    Join Date
    Feb 2008
    Posts
    1,232
    Blog Entries
    17
    Rep Power
    24

    Re: Reading E-Mail using imap in PHP

    dude thats awesome!
    Checkout my new forum! http://adminreference.com/

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. c++ mail
    By sh4 in forum C and C++
    Replies: 6
    Last Post: 01-12-2011, 11:38 PM
  2. IMAP Open gmail error. Too many e-mails
    By varu in forum PHP Development
    Replies: 2
    Last Post: 07-30-2010, 09:35 AM
  3. I need help with mail()
    By Xhris in forum PHP Development
    Replies: 12
    Last Post: 11-18-2008, 09:32 PM
  4. Php Mail
    By Jaan in forum PHP Development
    Replies: 4
    Last Post: 07-17-2008, 04:26 AM
  5. Don't use mail()?
    By bruder in forum PHP Development
    Replies: 3
    Last Post: 01-24-2008, 02:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts