php IMAP 连接到 hotmail

0 php pop3 imap

我正在使用 imap_open 连接到我的 hotmail 帐户。现在我想使用 imap_list() 来检查所有文件夹的列表,如收件箱、垃圾邮件、已发送等。

<?php
   $mbox = imap_open("{pop3.live.com:995/pop3/ssl}", "username", "password")
     or die("can't connect: " . imap_last_error());

    $boxes = imap_list($mbox, '{pop3.live.com:995/pop3/ssl}', '*');

    print_r($boxes);
    imap_close($mbox);
 ?>
Run Code Online (Sandbox Code Playgroud)

但它只显示收件箱。其实我想查看垃圾文件夹中的邮件。

Dee*_*k M 5

尝试

$username = 'username';
$password = 'password';
$server = '{imap-mail.outlook.com:993/ssl}';
$connection = imap_open($server, $username, $password);
$mailboxes = imap_list($connection, $server,'*');
print_r(imap_errors());
print_r($mailboxes);
imap_close($connection);
Run Code Online (Sandbox Code Playgroud)

它对我有用,希望对某人有帮助:)