int imap_open
(string mailbox, string username, string password, int
[flags]
);Returns an IMAP stream on success and false on error. This function can also be used to open streams to POP3 and NNTP servers. To connect to an IMAP server running on port 143 on the local machine, do the following:
1 2 $mbox = imap_open ("{localhost:143}INBOX", "user_id", "password"); 3 |
1 2 $mbox = imap_open ("{localhost/pop3:110}INBOX", "user_id", "password"); 3 |
1 2 $nntp = imap_open ("{localhost/nntp:119}comp.test", "", ""); 3 |
The options are a bit mask with one or more of the following:
OP_READONLY - Open mailbox read-only
OP_ANONYMOUS - Dont use or update a .newsrc for news (NNTP only)
OP_HALFOPEN - For IMAP and NNTP names, open a connection but dont open a mailbox
CL_EXPUNGE - Expunge mailbox automatically upon mailbox close
Example 1. imap_open() example
|