【问题标题】:IMAP gmail connection is very slow [closed]IMAP gmail连接很慢[关闭]
【发布时间】:2012-01-12 08:26:06
【问题描述】:

在我的 CRM 在线系统(用 PHP 制作)中,我处理 IMAP 连接。我对 gmail 有问题... 很长时间,很长时间:/ 连接总是需要 2-4 秒,我无法加快速度。在某处我读到在 imap 字符串 {imap.gmail.com:993/ssl} 中使用服务器的 ip insead 会很好,但证书有问题:/

有人有更多的想法吗?

【问题讨论】:

    标签: php performance gmail imap


    【解决方案1】:

    尝试将 IP 放入您的 /etc/hosts 文件并使用主机名。它会跳过 DNS 查找并直接输入 IP,但证书应该可以工作。顺便问一下,您使用哪些函数来访问 IMAP?

    使用此代码忽略证书问题:

    imap_open ("{IP_OF_GMAIL:995/imap/ssl/novalidate-cert}", "user_id", "password");
    

    【讨论】:

    • 但我无法访问服务器 - 我使用外部托管。 imap_open($this->getServerString(), $this->username, $this->password, $this->options, 1);
    • imap_open 有 /debug 参数,您可以使用它来解决问题。还有 /novalidate-cert 在通过 IP 连接时忽略证书问题。
    • 我会尝试 novalidate-cert - 我认为您不能将此标志与 /ssl 一起使用。
    • 抱歉,如果不在 SSL 中,您想在哪里使用证书?请查看 web 上的官方 PHP 文档以了解函数 imap_open
    • 试试这个:$result = imap_search($connection, 'UNSEEN');来自这篇文章:electrictoolbox.com/php-imap-unread-messages
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-09-01
    • 1970-01-01
    • 2011-03-20
    • 1970-01-01
    • 2013-11-18
    • 2013-08-01
    • 1970-01-01
    相关资源
    最近更新 更多