PHP get mail instance based on IMAP, IMAP get instance _php tutorial

Source: Internet
Author: User
Tags imap

PHP gets mail instance based on IMAP, IMAP gets instance


This article is an example of how PHP gets mail based on IMAP. Share to everyone for your reference. The implementation method is as follows:

IMAP is a mail interactive access protocol, the following is the main use of PHP IMAP module to quickly get mail, listing all directories, the code is as follows:
Copy the code 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);
Results:
Array
(
[0] = = Bulk Mail
[1] = Draft
[2] = Inbox
[3] = Sent
[4] = Trash
)
Reopen the specified directory:
Copy the code as follows: Imap_reopen ($inbox, $host. ' Bulk Mail ');
$emails = Imap_search ($inbox, ' all ');
Print_r ($emails);

Add:

1. Windows installation IMAP

Note In Windows we need to open an IMAP template in PHP.ini, find the Php_imap.dll extension in PHP and then turn it on, and if you see extensions there is no need to copy a past Php_imap.dll.

2. Installing IMAP in Linux

The final complete compilation of the IMAP module parameters is as follows:
Copy the Code code as follows:./configure--with-php-config=/usr/local/webserver/php/bin/php-config--WITH-KERBEROS=/USR-- With-imap-ssl=/usr
Make
Make install

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/909336.html www.bkjia.com true http://www.bkjia.com/PHPjc/909336.html techarticle php Get mail instance based on IMAP, IMAP get instance This article describes how PHP obtains mail based on IMAP. Share to everyone for your reference. The implementation method is as follows: IMAP is a ...

  • Related Article

    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.