Several commonly used php email sending codes (1/2)

Source: Internet
Author: User
Tags imap nntp nntp server php email imap port port number
The code is as follows: Copy code

<? 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 );
?>

 

Homepage 1 2 Last page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.