Incoming Mail Receiving in PHP

Discussion in 'PHP' started by cancer10, Aug 9, 2008.

  1. #1
    Hi,


    I just have downloaded the freeware version of ArGoSoft Mail Server and installed it on my PC.

    I am now able to send mails to localhost using PHP mail() function and can see the mail with outlook express.

    But does anyone know how do I view the incoming mails with PHP programming?

    OR

    is there any pre-made script to handle this?


    Thanx for your support.
     
    cancer10, Aug 9, 2008 IP
  2. 430AM

    430AM Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need a mail server to run such scripts ....... it will not work on localhost .....
     
    430AM, Aug 10, 2008 IP
  3. php-lover

    php-lover Active Member

    Messages:
    261
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    58
    #3
    You can implement your own php script, but first you have to do a search and reading on the following protocol.

    IMAP (Internet Message Access Protocol)
    POP3 (Post Office Protocol version 3)

    These two protocols is the standard protocol to read mail in PHP.
     
    php-lover, Aug 10, 2008 IP
  4. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #4
    mwasif, Aug 10, 2008 IP
  5. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    LOL, I have actually installed a Mailserver on my localhost and it works fine :)
     
    cancer10, Aug 10, 2008 IP
  6. iRakic

    iRakic Member

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #6
    If you are trying to send mail from windows with PHP using mail() function, you must first configure your php.ini file, and restart web server. For sending mails I prefer sending thru socket directly to SMTP server, because I have a better control over it.

    For checking (receiving) mails, you must understand how POP3 protocol works, or you can find some PHP class that do it for you. You can find most of them on PHP classes site.


    Regards,

    Ivan
     
    iRakic, Aug 10, 2008 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
  8. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I heard IMAP is used to read mails, is that true?
     
    cancer10, Aug 10, 2008 IP
  9. iRakic

    iRakic Member

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #9
    Yes, and no.
    IMAP is just another protocol like POP3, but it's different from POP3. For reading mails you will need a client application that will connect to IMAP.
     
    iRakic, Aug 10, 2008 IP
  10. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    k. Thanx for the reply.
     
    cancer10, Aug 16, 2008 IP
  11. php-lover

    php-lover Active Member

    Messages:
    261
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    58
    #11
    You can read your mail by using the following IMAP functions. What you need is the mail server and login details and use these function to do the work.


    imap_open()
    imap_close()
    imap_headers()
    imap_header()
    imap_fetchheader()
    imap_body()
    imap_delete()
    imap_xpunge()
     
    php-lover, Aug 16, 2008 IP
  12. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #12
    I just gotta say, reading incoming mail is a pain in the ass. I started programming my own the other day and got pretty far, but in the end figured it wasn't worth it.

    I did stumble across a class on the rather hideous website, PHP Classes, that does everything you need. With a bit of tinkering, I think it'll work great for you:

    http://www.phpclasses.org/browse/package/2.html

    Hope that helps!
     
    Louis11, Aug 17, 2008 IP
  13. cancer10

    cancer10 Guest

    Messages:
    364
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Thanx for the link mate :)
     
    cancer10, Aug 17, 2008 IP