imap_open
开启 IMAP 连结。
语法: int imap_open(string mailbox, string username, string password, int [flags]);
传回值: 整数
函式种类: 网路系统
本函式可打开客户端与伺服器之间的 IMAP 连结,并可连结至 POP3 或 NNTP 伺服器。参数 mailbox 为伺服器端的位置。参数 username 为使用者帐号。参数 password 为使用者的密码。参数 flags 可省略,有下列的值:
- OP_READONLY : 打开连结使用唯读状态。
- OP_ANONYMOUS : 匿名读取 NNTP 伺服器,不使用 .newsrc 档案。
- OP_HALFOPEN : 只与 IMAP 或 NNTP 伺服器连结,不开启邮箱。
- CL_EXPUNGE : 关闭连结时自动清除邮箱中的信件。
下例分别为开启 IMAP、POP3、NNTP 的部份参考范例
<?php $mbox = imap_open("{localhost:143}INBOX","user_id","password"); ?/font>}启与 IMAP 伺服器连结,IMAP 的埠 (port) 通?/font>`为 143。 $mbox = imap_open("{localhost/pop3:110}INBOX","user_id","password"); \\ ?/font>}启与 POP3 伺服器连结,POP3 的埠值为 110。 $nntp = imap_open("{localhost/nntp:119}comp.test","",""); \\ ?/font>}启与 NNTP 伺服器连结,NNTP 的埠为 119。 ?>
|