如何保护imap_open连接 [英] How to secure imap_open connection

查看:181
本文介绍了如何保护imap_open连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用imap_open()与我的邮件服务器建立连接以检查退回的电子邮件.

i use imap_open() to establish a connection with my mailserver for checking bounced emails.

$pop3conn  = imap_open('{localhost:110/pop3}', MAILLOGIN, MAILPWD);

if($pop3conn == false)
echo'<br />no conn';
else
{
    // check mail headers and bodies
}

我收到有关不安全身份验证的PHP通知:

I get a PHP Notice about insecure authentication:

通知:未知:安全问题:广告不安全的服务器 在第0行的AUTH = PLAIN(errflg = 1)中未知

Notice: Unknown: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN (errflg=1) in Unknown on line 0

我已经在php.net上搜索并用Google搜索了几个小时,但是找不到解决方法.

I have searched on php.net and googled for hours, but can't find a solution how to get rid of this.

我发现的唯一一件事也行不通:向服务器名添加/secure.

the only thing i found did also not work: adding /secure to the servername.

$pop3conn  = imap_open('{localhost:110/pop3/secure}', MAILLOGIN, MAILPWD);

然后我得到:

注意:未知:无法使用此服务器进行安全身份验证 (errflg = 2)在第0行的未知"中

Notice: Unknown: Can't do secure authentication with this server (errflg=2) in Unknown on line 0

在此先感谢您的帮助!

推荐答案

这给了你in Unknown on line 0令我有些惊讶,因为这通常仅在脚本开始执行之前发生错误时才会发生-但是,唯一的解决此问题的方法是隐藏PHP错误.

I am a little surprised this is giving you in Unknown on line 0 as this normally only happens when the error occurs before the script begins to execute - however, the only real solution to this problem is to hide PHP errors.

您似乎要连接的服务器不支持安全身份验证,对此的唯一解决方案是要求服务器管理员支持它.或使用其他服务器.您无法在代码中采取任何措施来解决该特定问题,因此您只需要处理该错误而不是尝试修复该错误(就像我讨厌向任何人推荐该方法一样).

It looks as though the server you are connecting to doesn't support secure authentication, and the only solution to this is to ask the server administrator to support it. Or to use a different server. There is nothing you can do in your code to work around that particular problem, so you will just have to handle the error instead of trying to fix it (much as I hate to recommend that approach to anyone for anything).

您可能会发现即使调用ini_set('display_errors', 0)或使用邪恶的@运算符也无法解决此问题,因为它是in Unknown on line 0-尽管无论如何您都不应该在生产环境中显示PHP错误.您应该确保将生产中的php.ini设置为向用户隐藏错误.

You may find that even calling ini_set('display_errors', 0) or using the evil @ operator won't fix this, since it is in Unknown on line 0 - although you shouldn't be showing PHP errors in a production environment anyway. You should ensure that your php.ini in production is set to hide errors from the user.

这篇关于如何保护imap_open连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆