我一直在搜索,但是找不到解决方案。我需要从Outlook帐户中读取收件箱,但什至无法连接到我的帐户
$hostname = '{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX';
$username = 'mymail@outlook.com';
$password = 'topsecret';
/* try to connect */
//$inbox = imap_open($hostname,$username,$password) or die('Cannot connect
to '.$hostname.': ' . imap_last_error());
//imap_open("
{outlook.office365.com:993/imap/ssl/authuser=mymail@outlook.com}",
"mymail@outlook.com", "topsecret");
//$user = 'my.mail@outlook.com';
//$pass = 'topsecret';
//imap_open("{outlook.office365.com:993/imap/ssl/novalidate-
cert/authuser=$user/user=$user}", $user, $pass);
$authhost = "{outlook.office365.com:993/imap/ssl}INBOX";
$email = "mymail@outlook.com";//dummy text. I swear i dont have typo here
$emailPassword = "topsecret";//dummy text. No typo here.
$mailbox = imap_open($authhost, $email, $emailPassword);
$mails = imap_search($mailbox, "ALL");
foreach ($mails as $mail) {
$mail_headers = imap_headerinfo($mailbox, $mail);
$structure = imap_fetchstructure($mailbox, $mail);
imap_delete($mailbox, $mail);
}
imap_expunge($mailbox);
imap_close($mailbox);
echo "Connected<br\>";
但总是会收到此错误:
Warning: imap_open(): Couldn't open stream
{outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX in
C:\wamp64\www\correo\index.php on line 7