【问题标题】:Non SSL connection to gmail using node-imap使用 node-imap 与 gmail 的非 SSL 连接
【发布时间】:2014-05-10 09:57:36
【问题描述】:

我正在尝试使用 node-imap 模块连接到 gmail。以下代码抛出超时错误。

var Imap = require('imap');
var imapConnection = new Imap({
    user: process.argv[2],
password: process.argv[3],
host: "imap.gmail.com",
port: 993,
debug: console.log
});
imapConnection.connect();

{ [Error: Timed out while connecting to server] source: 'timeout' }

注意:如果我给了tls:truetlsOptions: { rejectUnauthorized: false},则连接良好。如何在没有 SSL 的情况下连接到 gmail。

补充信息:我的节点版本是v0.10.25

【问题讨论】:

  • 我不能肯定,但 Gmail 很可能需要 SSL。为什么你需要连接没有它?

标签: node.js imap


【解决方案1】:

Gmail 需要 SSL。它们不允许明文连接。

【讨论】:

    【解决方案2】:

    尝试如下:

    var Imap = require('imap');
    var imapConnection = new Imap({
    user: process.argv[2],
    password: process.argv[3],
    host: "imap.gmail.com",
    authTimeout:300000, // increased to 5 mins
    port: 993,
    debug: console.log
    });
    imapConnection.connect();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-01
      • 2010-11-19
      • 2013-09-11
      • 2020-04-25
      • 2015-11-20
      • 1970-01-01
      • 2016-09-01
      • 1970-01-01
      相关资源
      最近更新 更多