<?php//连接企业微信邮箱 imap 服务器
$imapPath = "{imap.exmail.qq.com:993/imap/ssl}INBOX";
$username = 'kevlin@aaa.com';
$password = 'aa'; //这个密码是下图所设置的//打开连接
$inbox = imap_open($imapPath, $username, $password) or die('Cannot connect to Email: ' . imap_last_error());//搜索邮件
$emails = imap_search($inbox, 'ALL');// 遍历邮件
foreach ($emails as $email_number) {$overview = imap_fetch_overview($inbox,$email_number,0);//邮件主题$subject = $overview[0]->subject;//发送人$from = $overview[0]->from;//邮件日期$date = $overview[0]->date;//邮件内容$message = imap_fetchbody($inbox,$email_number,1.1);var_dump($from);var_dump($date);var_dump($message);die();//处理内容// ...}//关闭连接
imap_close($inbox);