Fetching mail from a POP3 server using php

后端 未结 4 1361
逝去的感伤
逝去的感伤 2020-12-01 04:42

I am trying to fetch a mail from POP3 (I am using POP3 mail server and I am trying to fetch the mail content and store into a database table for my project.), but I can\'t f

4条回答
  •  天涯浪人
    2020-12-01 05:04

    Somewhat surprisingly, PHP's imap library can be also used for working with POP3 mailboxes. Most of the advanced IMAP features won't work, of course (e.g. folders or fetching message parts), but the basic POP3 functionality is implemented.

    The main difference is the option string that you're passing to imap_open - to quote that page:

    // To connect to a POP3 server on port 110 on the local server, use:
    $mbox = imap_open ("{localhost:110/pop3}INBOX", "user_id", "password");
    

    Other than that, it's fair sailing - you won't need more than imap_open, imap_num_msg, imap_body, imap_delete and imap_close for basic POP3 access.

提交回复
热议问题