nicm/fdm

Fetching only new mail

salotz opened this issue · 2 comments

I'm trying to run both a task that only fetches the new mail (via cron every 15 minutes) like:

fdm -kv -a account@example.com_new fetch

And one for all the mail every night:

fdm -kv -a account@example.com fetch

The problem is that the only solution I could come up with uses separate accounts using the new-only option e.g.:

account "account@example.com_new"
imaps server "mail.example.com"
port 993
user "user"
pass ...
new-only

This has the effect of giving my duplicate mail because the "Received: " header is different:

  --> diff 1593148327.17714_0.ostrich 1593135907.18272_0.ostrich

  3,4c3,4
  < Received: by ostrich (fdm 1.7, account "account@example.com");
  < 	Fri, 26 Jun 2020 01:12:07 -0400
  ---
  > Received: by ostrich (fdm 1.7, account "account@example.com_new");
  > 	Thu, 25 Jun 2020 21:45:07 -0400

What can I do?

I'm assuming there is a more elegant way to do this but after reading the man page I couldn't find it.

nicm commented

If you get rid of duplicates won't the "all mail" fetch get no mail because the new-only fetch will get it all?

You can use the no-received option so fdm doesn't add a Received header.

Or use a cache with the message ID to make fdm ignore duplicate mails.

If you get rid of duplicates won't the "all mail" fetch get no mail because the new-only fetch will get it all?

I use other clients that mark things as read and so the 'new-only' won't get those (at least it looked like this was happening, not an expert in IMAP). The "all mail" fetch is for backups so I want to make sure I get those.

You can use the no-received option so fdm doesn't add a Received header.

That works thanks. Ya the cache prolly would work but I couldn't wrap my head around it.