<? Php // Connect to the IMAP server, and the IMAP port is 143. $ Mbox = imap_open ("{localhost: 143} INBOX", "user_id", "password "); // Connect to the POP3 server. The POP3 port is 110. $ Mbox = imap_open ("{localhost/pop3: 110} INBOX", "user_id", "password "); // Connect to the NNTP server. The port number of NNTP is 119. $ Nntp = imap_open ("{localhost/nntp: 119} comp. test ","",""); ?> <? Php // Connect to the IMAP server $ Mbox = imap_open ("{imap.example.org}", "username", "password", OP_HALFOPEN) Or die ("connection failed:". imap_last_error ()); $ List = imap_getmailboxes ($ mbox, "{imap.example.org }","*"); If (is_array ($ list )){ Foreach ($ list as $ key => $ val ){ Echo "($ key )"; Echo imap_utf7_decode ($ val-> name ).","; Echo "'". $ val-> delimiter ."',"; Echo $ val-> attributes. "<br/> "; } } Else { Echo "imap_getmailboxes failed:". imap_last_error ().""; } // Close the imap connection Imap_close ($ mbox ); ?> |