为什么不能连接PHP imap/pop3?

3

对不起,我的英语不是很好。

有些日子很努力地尝试了,阅读了所有关于这个问题的stackoverflow的问题和答案,但没有帮助。

我只想要一个imap连接。

我尝试了一些webhost,但都不起作用。

请帮忙。

// $foo = "{pop3.indamail.hu:110}"; // [CLOSED] IMAP connection broken (server response)
// $foo = "{pop3.indamail.hu:110/pop3}"; // Can not authenticate to POP3 server: POP3 connection broken in response
// $foo = "{imap.indamail.hu:143}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{pop3.indamail.hu:110/pop3}INBOX"; // Can not authenticate to POP3 server: POP3 connection broken in response
// $foo = "{imap.indamail.hu:143/imap}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap/tls}INBOX"; // Unable to negotiate TLS with this server
// $foo = "{imap.indamail.hu:143/imap/notls}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:143/imap/novalidate-cert}INBOX"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{imap.indamail.hu:993/imap}"; // [CLOSED] IMAP connection broken (server response)
// $foo = "{pop3.indamail.hu:995/pop3}"; // POP3 connection broken in response
// $foo = "{imap.indamail.hu:993/imap/ssl/novalidate-cert}"; // Can not authenticate to IMAP server: [CLOSED] IMAP connection broken (authenticate)
// $foo = "{pop3.indamail.hu:995/pop3/ssl/novalidate-cert}"; // Can not authenticate to POP3 server: POP3 connection broken in response
$mbox = imap_open ( $foo, "********@indamail.hu", "********" ) or die ( imap_last_error () );

错误,请查看代码。
我尝试过,但只是勉强可以。
// $fp = fsockopen ( "imap.indamail.hu", 143, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "imap.indamail.hu", 993, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "pop3.indamail.hu", 110, $errno, $errstr, 30 ); // ok
// $fp = fsockopen ( "pop3.indamail.hu", 995, $errno, $errstr, 30 ); // ok

// $fp = fsockopen ( "imap.indamail.hu", 992, $errno, $errstr, 30 ); // Connection timed out (110)

if ( ! $fp ) {
    echo "$errstr ($errno)";
} else {
    echo "ok";
    fclose ( $fp );
}

重要提示!仅限以下国家访问:HU、SK、AT、RO、HR。我的 IP 地址是 HU/匈牙利。我已阅读手册,认为只需要使用以下端口:pop3:110 和 imap:143。

请帮助我。


在输入密码时,无需输入登录密码,而是需要输入POP3/IMAP密码(来自其网站的信息)。您是否正确使用了它? - Martin Osusky
现在,大多数网站都要求加密的POP3(端口995)或IMAP(端口993)。 - Max
@MartinOsusky 是的,我正在正确使用它。我知道。Webmail密码与pop3 / imap密码不同。 - jozs2021
@Max 我已经编辑了问题并添加了几个测试。993/995端口都不可用。 - jozs2021
2个回答

0

它运行正常。

$e = '********@indamail.hu';
$s = '{imap.indamail.hu:143/authuser=' . $e . '}';
$mbox = imap_open ( $s, $e, '********' ) or die ( imap_last_error () );

无评论。


0

我认为POP3连接断开的响应意味着暂时的连接失败。

我为什么这样想?

因为我一直在调试一个POP3客户端程序。在我连续几次访问我的托管提供商的POP3服务器之后,我认为他们将我锁定了。同样可能的是,我尝试在邮箱上采取多个并发的独占锁。

我认为这个消息来自于php-imap。我认为它告诉调用imap_login()的人,POP3服务器在身份验证期间使tcp连接停顿,然后突然关闭了它。 这是一个合理的DOS攻击反制措施。在调试时不小心触发了它。

过了一会儿,一切又开始正常工作了。

这个POP3是一个古老的协议。RFC1939说它只有两个状态消息:+OK some random text-ERR some other random text。所以那些imap_errors()字符串的内容就是程序员当天认为有帮助的任何内容。唉。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接