此代码在我的国家埃及工作得很好我每次将它上传到位于英国的服务器时都不起作用,这似乎是一个国家身份验证问题。 即使在Hotmail设置中,有没有办法克服这个限制
class Hotmail {
private $_email;
private $_password;
private $_host = "{imap-mail.outlook.com:993/ssl}Inbox";
public function __construct($email, $password) {
$this->_email = $email;
$this->_password = $password;
}
public function authenticate() {
if ($mbox = imap_open($this->_host, $this->_email, $this->_password)) {
$imap_obj = imap_check($mbox);
echo "<h1>CONNECTED TO IMAP HOST</h1><h2>$this->_host (" . $imap_obj->Nmsgs . ")<h2>";
} else {
echo imap_last_error();
echo "<h1>FAILED TO CONNECT TO IMAP HOST!</h1>\n";
die;
}
echo "<h3>IMAP LIST OF FOLDERS</h3>";
$folders = imap_list($mbox, $this->_host, "*");
echo "<ul>";
foreach ($folders as $folder) {
echo '<li><a href="mail.php?folder=' . $folder . '&func=view">' . imap_utf7_decode($folder) . '</a></li>';
}
echo "</ul>";
imap_close($mbox);
}
}
$hotmail = new Hotmail('sahar_24@outlook.com', '01277217631!');
$hotmail->authenticate();
在埃及的回报:连接 在英国返回FAILED TO CONNECT作为echo imap_last_error();返回以下消息: 无法对IMAP服务器进行身份验证:[AUTHORIZATIONFAILED]帐户被阻止。通过网络浏览登录您的帐户