Example of using imap inbox in PHP

Source: Internet
Author: User
Tags imap
Imap is a mail interaction access protocol. I will introduce the example of using the phpimap module to quickly obtain emails. if you are interested, refer to it to list all directories, the code is as follows: $ host #39 ;... imap is a mail interaction access protocol. I will introduce the example of using the php imap module to quickly obtain emails. if you are interested, refer to it to list all directories, the code is as follows:

$host = '{imap.mail.yahoo.com:993/ssl}'; $user = 'user@yahoo.com'; $pass = 'password'; $inbox = imap_open($host, $user, $pass); $mailboxes = imap_list($inbox, $host, '*'); $mailboxes = str_replace($host, '', $mailboxes); print_r($mailboxes);

// Result:

Array ( [0] => Bulk Mail [1] => Draft [2] => Inbox [3] => Sent [4] => Trash )

Re-open the specified directory:

imap_reopen($inbox, $host.'Bulk Mail'); $emails = imap_search($inbox,'ALL'); print_r($emails);

Install imap in windows

Note that in windows, we need to enable an imap template in php. ini. find the php_imap.dll extension in php and enable it. if you see no extensions, you need to copy the php_imap.dll file.

Install imap in linux

Finally, complete parameters of the imap compilation module are as follows:

./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-kerberos=/usr --with-imap-ssl=/usr make make install


Permanent link:

Reprint at will! Include the article address.

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.