PHP obtains the Mail instance based on imap and imap obtains the instance. PHP obtains mail instances based on imap. imap obtains instances. This article describes how PHP obtains mails based on imap. Share it with you for your reference. The specific implementation method is as follows: imap is a PHP imap-based get email instance, imap get instance
This example describes how PHP obtains mails based on imap. Share it with you for your reference. The specific implementation method is as follows:
Imap is a mail interaction access protocol. the following example uses the php imap module to quickly obtain emails and list all directories. the code is as follows:
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:
The code is as follows:
Imap_reopen ($ inbox, $ host. 'bulk mail ');
$ Emails = imap_search ($ inbox, 'all ');
Print_r ($ emails );
Supplement:
1. 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.
2. install imap in linux
Finally, complete parameters of the imap compilation module are as follows:
The code is 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 will help you with PHP programming.
Examples in this article describes how PHP obtains mails based on imap. Share it with you for your reference. The specific implementation method is as follows: imap is...