php imap_open 与 Microsoft 交换(Outlook 网络应用程序)

php imap_open with microsoft exchange (outlook web app)

我工作的公司从 Lotus Notes 迁移到 Microsoft Exchange with Outlook Web App。自 2014 年以来,使用 Lotus Notes,我的 PHP 脚本运行良好。自从迁移到 MS Exchange 后,PHP 的 imap_open 无法再访问此邮件帐户。

我的 PHP 代码如下所示:

$emHOST = '{mail.company.com/tls/novalidate-cert}';
$emUSER = 'e-mail@company.com';
$emPASW = 'password';
$emPOP = imap_open($emHOST, $emUSER, $emPASW);
print_r(imap_errors());

无论我通过 PHP 尝试什么,我都会得到 'LOGIN failed':

Array
(
    [0] => LOGIN failed.
    [1] => LOGIN failed.
    [2] => LOGIN failed.
    [3] => Too many login failures
)

我尝试使用 /ssl 而不是 /tls,但这会导致端口 993 超时。

但是,我可以在网络浏览器中通过 https://mail.company.com/owa 使用相同的用户名和密码登录。

有没有人能给我一些提示让我再次获得这东西 运行? 谢谢!

对于 MS Exchange,IMAP 或 POP3 通常不启用,如 Microsoft here for IMAP:

By default, the two IMAP4 services, the Microsoft Exchange IMAP4 service and the Microsoft Exchange IMAP4 Backend service, aren’t started on computers running Microsoft Exchange Server 2013. You must start these two services to allow your email clients to connect to Exchange using IMAP4. When these services are running, Exchange 2013 accepts unsecured IMAP4 client communications on port 143 and over port 993 using Secure Sockets Layer (SSL).

here for POP3:

By default, the two POP3 services, the Microsoft Exchange POP3 service and the Microsoft Exchange POP3 Backend service, aren’t started on computers running Microsoft Exchange Server 2013. You must start these two services to allow your email clients to connect to Exchange using POP3. When these services are running, Exchange 2013 accepts unsecured POP3 client communications on port 110 and over port 995 using Secure Sockets Layer (SSL).

这是因为 MS Outlook 客户端使用 MAPI or MAPI over HTTP to communicate with the MS Exchange Server (similar like an Lotus Notes client didn´t need POP3 or IMAP, it used a TPC/IP connection over port 1352) [SideNote: MS Outlook for MAC used EWS]

因此,如果启用了 IMAP,请与您的交换管理员联系,他可能会为您启用。

如果不是您的方式,您可能希望使用 Exchange Webservices (EWS) in a further version with your Script. A good starting point might be "How to: Work with Exchange mailbox items by using EWS in Exchange"

经过一周的等待,负责的 IT 部门现在终于正确配置了 OWA。我可以用'{mail.company.com:143}'登录IMAP邮箱