无法使用 IMAP 和 PHP 访问 Office365 帐户



我正在尝试访问Office365收件箱,但是我收到此消息

PHP Warning:  imap_open(): Couldn't open stream {outlook.office365.com:993/imap/ssl}

这是我的代码

$hostname = '{outlook.office365.com:993/imap/ssl/novalidate-cert}';
$username = '*****';
$password = '*****';
$fp = fopen('cox_cash [30 40].txt', 'w+');
if (!$fp) die("Impossible d'ouvrir le fichier");
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to : ' . imap_last_error());

对我来说,问题不是PHP的IMAP库。尝试使用function_exists('imap_open'(检查您是否实际拥有库。

function_exists((如果您的php具有函数,则返回true,否则为false。简单的if语句与Echos有关。

最新更新