Getmail:连接被对等方重置(IMAP 空闲)

Getmail:连接被对等方重置(IMAP 空闲)

我正在尝试使用 getmail 从 IMAP 空闲服务器接收邮件。

由于我能够使用 Mac OS 的邮件应用程序从同一服务器(邮件地址提供商)上的另一个帐户接收邮件,因此服务器应该支持 IMAP Idle。

但是,一段时间后(不知道这花了多长时间),连接关闭并引发异常:

getmail version 4.46.0
Copyright (C) 1998-2012 Charles Cazabon.  Licensed under the GNU GPL version 2.
SimpleIMAPSSLRetriever:<address>@<server>:993:
  0 messages (0 bytes) retrieved, 0 skipped
IDLE message received
  msg 1/1 (1534 bytes) from <sender> delivered to MDA_external command procmail (), deleted
  1 messages (1534 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
  0 messages (0 bytes) retrieved, 0 skipped
IDLE message received

Exception: please read docs/BUGS and include the following information in any bug report:

  getmail version 4.46.0
  Python version 2.7.9 (default, Sep 17 2016, 20:26:04) 
[GCC 4.9.2]

Unhandled exception follows:
    File "/usr/bin/getmail", line 866, in main
    success = go(configs, options.idle)
    File "/usr/bin/getmail", line 425, in go
    idling = retriever.go_idle(idle)
    File "/usr/lib/python2.7/dist-packages/getmailcore/_retrieverbases.py", line 1750, in go_idle
    self.conn.send('DONE\r\n')
    File "/usr/lib/python2.7/imaplib.py", line 1195, in send
    sent = self.sslobj.write(data)
    File "/usr/lib/python2.7/ssl.py", line 626, in write
    return self._sslobj.write(data)
  error: [Errno 104] Connection reset by peer

Please also include configuration information from running getmail
with your normal options plus "--dump".

getmail 配置如下所示:

[retriever]
type = SimpleIMAPSSLRetriever
server = <IMAPserver>
port = 993
username = <username>
password = <password>
mailboxes = ALL

[destination]
type = MDA_external
path = /usr/bin/procmail

[options]
read_all = true
delivered_to = false
received = false
message_log = ~/.getmail/getmail.log
verbose = 2
delete = true

有人对如何解决这个问题有一些提示吗?我没有任何起点,因为我是使用 getmail 的初学者。

因为我计划将来使用supervisord,所以我可以使用supervisor来重新启动getmail,这应该可以完成这项工作,但从技术角度来看,这并不是一个好的做法。

答案1

我的 getmail 配置看起来和你的一样。

不过,我将 getmail 作为 2 分钟的 cronjob 运行,每两分钟检查一次。

 */2 * * * * getmail --quiet

这个 cron 作业以我的登录名而不是 root 身份运行。我大约每周都会遇到一次同样的断线情况。去年,英国发生了一场电子邮件转发风暴,gmail出现了连接问题。我有很多脱节的情况。

type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username =
password =
mailboxes = ("Inbox", "[Gmail]/Spam" )
#port = 993

[destination]
type = Maildir
path = 

[options]
verbose = 2
read_all = no
delete = yes
message_log = ~xxx/.getmail/log
# prevent getmail from adding a received header to the message as it is saved
 received = false
 # prevent getmail from adding a delivered_to header to the message as it is saved
 delivered_to = false
 #delete messages 1 day after first seeing them
 delete_after = 1

相关内容