PHP Imap_open Instance Tutorial

Source: Internet
Author: User
Tags imap nntp nntp server imap port

IMAP connection server code.

<?php
Connect an IMAP server link with an IMAP port of 143.
$mbox = Imap_open ("{Localhost:143}inbox", "user_id", "password");
Connection POP3 Server link, POP3 port is 110.
$mbox = Imap_open ("{Localhost/pop3:110}inbox", "user_id", "password");
Connect to the NNTP Server link, NNTP has a port of 119.
$NNTP = Imap_open ("{localhost/nntp:119}comp.test", "" "," ");
?>

A bit more complex IMAP connection method.

<?php
Connecting to an 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/>n";
}
} else {
echo "Imap_getmailboxes failed:". Imap_last_error (). "N";
}
Turn off IMAP connections
Imap_close ($mbox);
?>

Please specify www.111cn.net/phper/php.html

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.