View Single Post
Old 28 Jul 2019, 06:56 AM   #1
jd2066
Junior Member
 
Join Date: Jul 2016
Posts: 3
Does FastMail have a better way then IMAP Idle to know when you get new emails?

Hey,
I use the FastMail service in an unusual way.
I have IMAP/STMP services on my personal home server that I can access remotely and such that I prefer over using remotely hosted services for various reasons.
However my home server is not reliable enough to have messages directly delivered to it (partly because I may do something that temporarily makes my server unavailable or my cable internet connection goes down and whatnot).

I use getmail to fetch any new messages from my FastMail account with the following configuration file:
Code:
[retriever]
type = SimpleIMAPSSLRetriever
server = imap.fastmail.com
username = mymailbox@example.com
password = mypassword
mailboxes = ("INBOX",)
move_on_delete = "Retrieved using getmail"

[options]
received = false
delivered_to = false
read_all = false
delete = true
verbose = 1
message_log = /var/log/getmailrc-justin/mymailboxe@mydomain.log
message_log_verbose = false

[destination]
type = MDA_external
path = /usr/libexec/dovecot/dovecot-lda
arguments = ("-e", "-f", "%(sender)", "-d", "justin")
I run getmail using the command
Code:
getmail -g /home/justin/.config/getmail -r rc-mymailbox@example.com -i Inbox
.

It creates an IMAP Idle connection to FastMail so getmail knows instantly if there is new mail available and retrieves the email and then puts the email on FastMail in my "Retrieved using getmail" folder which I have set on FastMail to auto-delete the emails in every 30 days or so.

If getmail cannot connect to FastMail for whatever reason, I can login to FastMail.com and every email in the Inbox folder will be one that wasn't retrieved so I can see emails that I did not get due to some error or something and when getmail is running again, those messages will be retrieved.

I prefer IMAP idle over POP3 due to the instant knowing of a new email being available, with POP3 I would need to check every 5 minutes or so.

The MDA_external commend hands the email over to the Dovecot LDA service to run sieve filters on the email and then store the email in the file system so they can be be accessed via the Dovecot IMAP service.

However over the past few months I frequently get this error in the getmail log file "getmailOperationError error (IMAP error (command: UID => socket error: EOF))" which apparently means the connection to FastMail's IMAP service using IMAP Idle has been disconnected.
I'm not sure why but getmail's behavior when the IMAP Idle connection is disconnected is to just to close so until I manually restart getmail again I don't get email retreival.

I'm not sure if FastMail changed something recently, something happened with my internet provider or whatnot but I keep needing to restart getmail at least once a day and usually more now.

In the past, only my internet connection going away could cause the IMAP Idle connection to stop working so I rarely had to restart getmail again.

If there was some FastMail API I could use that was a more reliable way to know about new emails then I could just use that and tell it to run getmail whenever that API says new email is available.

Before FastMail I was using Google's email for domains service but their IMAP server worked in non-standard ways along with other things that I did not like.
jd2066 is offline   Reply With Quote