dcblogdev/imap
Composer 安装命令:
composer require dcblogdev/imap
包简介
IMAP class for reading imap emails with PHP
README 文档
README
IMAP class for reading IMAP emails with PHP
Example usage:
use Dcblogdev\Imap\Imap; //set search criteria $date = date('d-M-y', strtotime('1 week ago')); $term = 'ALL UNDELETED SINCE "'.$date.'"'; //ignore array of emails $exclude = []; $email = 'someone@domain.com'; $password = 'emailpassword'; $host = 'outlook.office365.com';//your email host $port = '993';//port number $savePath = "emails";//folder to save attachments $markAsSeen = true;//when true mark email as been read $delete = false;//set to true to delete email //initialise email $imap = new Imap($email, $password, $host, $port, 'Inbox', $savePath, $markAsSeen, $delete); //get emails pass in the search term and exclude array $emails = $imap->emails($term, $exclude); //loop over emails and display foreach($emails as $email) { echo "Account {$email['account']}<br>"; echo "Subject {$email['subject']}<br>"; echo "From {$email['fromName']} ({$email['fromAddress']})<br>"; echo "To {$email['toAddress']}<br>"; echo "CC {$email['ccAddress']}<br>"; echo "Date {$email['emailDate']}<br>"; echo count($email['attachments'])." Attachments<br>"; foreach($email['attachments'] as $attachment) { echo "<a href='{$attachment['file']}'>{$attachment['fileName']}</a>"; } echo "<br><br>"; if ($email['htmlBody'] !='') { echo $email['htmlBody']; } else { echo nl2br($email['plainBody']); } echo "<hr>"; }
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-15