nand2 / php-imap
管理邮箱,过滤/获取/删除 PHP 中的电子邮件(支持 IMAP/POP3/NNTP)
3.0.7
2019-04-02 09:05 UTC
Requires
- php: >=5.5
- ext-imap: *
README
功能
- 通过 PHP IMAP 扩展 使用 POP3/IMAP/NNTP 连接到邮箱
- 获取带附件和内联图片的电子邮件
- 根据自定义标准过滤或排序电子邮件
- 标记电子邮件为已读/未读
- 删除电子邮件
- 管理邮箱文件夹
需求
- IMAP 扩展必须存在;因此请确保在您的 php.ini 文件中此行是激活的:
extension=php_imap.dll
使用 Composer 安装
$ composer require php-imap/php-imap
与框架集成
- Symfony - https://github.com/secit-pl/imap-bundle
使用示例
// 4. argument is the directory into which attachments are to be saved: $mailbox = new PhpImap\Mailbox('{imap.gmail.com:993/imap/ssl}INBOX', 'some@gmail.com', '*********', __DIR__); // Read all messaged into an array: $mailsIds = $mailbox->searchMailbox('ALL'); if(!$mailsIds) { die('Mailbox is empty'); } // Get the first message and save its attachment(s) to disk: $mail = $mailbox->getMail($mailsIds[0]); print_r($mail); echo "\n\nAttachments:\n"; print_r($mail->getAttachments());
推荐
- Google Chrome 扩展 PHP Console
- Google Chrome 扩展 JavaScript Errors Notifier