3

I am trying to receive mails using getmail from an IMAP Idle server.

Since I am able to receive mails using Mac OS' Mail app from another account on the same server (mail adress provider), IMAP Idle should be supported by the server.

However, after some time (do not know how long this took) the connection is closed and an exception is raised:

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".

The getmail config looks like this:

[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

Does anyone has some hints about how to get this issue solved? I do not have any starting point as I am a beginner in using getmail.

Since I am planning to use supervisord in the future I could use supervisor to restart getmail which should do the job, but this does not feel to be good practise from a technical point of view.

  • does getmail.log contain something different than your first quote snippet? – hyph Mar 11 '17 at 13:05
  • @hyph: The log just lists messages of mail handling like 2017-03-11 11:40:56 msg 1/1 (1534 bytes) msgid 369398334/40 from <sender@server.com> delivered to MDA_external command procmail (), deleted – albert Mar 11 '17 at 16:36
1

My getmail config looks like yours.

However I run my getmail as a 2 minute cronjob which checks every two minutes.

 */2 * * * * getmail --quiet

This cron job runs as my login and not as root. I get the same disconnect about once a week. In the last year, an email forward storm happened in Britain and gmail had trouble with connections. I had a lot of the disconnects.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.