PHP IMAP with Office365 mail


PHP IMAP with Office365 mail

我在我的问题上搜索了多个SO主题,找不到任何可以解决我的问题的主题。(这里有一个类似的例子:用PHP访问Office356共享邮箱)

当前尝试将IMAP PHP连接到outlook box,我可以成功地将IMAP box添加到我的邮件客户端(mac)并接收电子邮件,尽管使用PHP时我似乎无法使其工作

我代码:

$hostname = '{outlook.office365.com:993/imap/ssl}INBOX';
$username = 'email@example.com';
$password = 'password';
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());

我也试过添加novalidate-cert等,但似乎没有任何区别

我得到的错误:

 imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl}INBOX
 [ErrorException]
 imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl/novalidate-cert}INBOX

希望有人能给我指路

在office365中,您无法打开IMAP for Exchange Online Kiosk许可证…