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.