PHP imap_open()=>;[身份验证失败]

PHP imap_open()=>;[身份验证失败],php,email,imap,Php,Email,Imap,我正在尝试设置与邮件服务器的IMAP连接,问题是它无法连接邮件: array(4) { [0]=> string(81) "Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed." [1]=> string(81) "Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication fai

我正在尝试设置与邮件服务器的IMAP连接,问题是它无法连接邮件:

array(4) {
  [0]=> string(81) "Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed."
  [1]=> string(81) "Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed."
  [2]=> string(82) "Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Authentication failed."
  [3]=> string(49) "[CLOSED] IMAP connection broken (server response)"
}
我用来打开连接的代码是:

$mbox = imap_open('{server.test.com:993/imap/ssl}INBOX', 'user@test.com', 'password');
我已经为我的Gmail帐户测试了相同的语法,效果很好。我可以连接到
server.test.com
,还可以使用thunderbird(IMAP-SSL-993)进行身份验证,因此邮件服务器并没有问题

我已经在堆栈溢出中搜索了这个问题,但还没有解决它,以下是我迄今为止尝试过的所有解决方案:

  • $mbox=imap_open({server.test.com:993/imap/ssl}收件箱,'user@test.com','password',null,1,数组('DISABLE_AUTHENTICATOR'=>'PLAIN')
  • $mbox=imap_open({server.test.com:995/pop3/ssl}收件箱,'user@test.com“,”密码“)
  • $mbox=imap_open({server.test.com:993/imap/ssl/novalidate cert}收件箱,'user@test.com“,”密码“);(证书有效)
  • $mbox=imap_open({server.test.com:993/pop3/ssl/novalidate cert}收件箱,'user@test.com“,”密码“);(证书有效)
  • $mbox=imap_open({server.test.com:993/imap}收件箱,'user@test.com“,”密码“)
  • $mbox=imap_open({server.test.com:993/pop3}收件箱,'user@test.com“,”密码“)
  • $mbox=imap_open({server.test.com:993}收件箱,'user@test.com“,”密码“)
  • 你知道问题来自哪里吗?我还将在稍后发布针对上述所有解决方案收到的所有错误消息以及邮件服务器和php日志

    注意:为了表示我正在使用的错误:

    var_dump(imap_errors());
    

    因为web服务器和邮件服务器在同一台服务器上运行,所以我设法连接到服务器IP地址:

    $mbox = imap_open('{127.0.0.1:993/imap/ssl/novalidate-cert}INBOX', 'user@test.com', 'password');
    

    我唯一的建议是,在运行网络嗅探器时尝试使用非SSL IMAP端口143,以查看实际发生的情况。您知道远程服务器正在使用什么软件吗?你绝对确定你的密码是正确的吗?:)很抱歉我反应太晚了@Max我非常确定密码是正确的,因为我已重置密码并将其粘贴到脚本中(我对此进行了双重检查)。“它正在运行Dovecot。@AlexHowansky,如果我没有通过这个解决方案,那就是下一步了。