Only import older mails than <date>

Issue #887 closed
Rico 'Xaneorath' Tröger created an issue

So, I have been tasked to implement another customization for my employer, and as usual I'd be happy about any form of hints/input I can get about the task. Of course I'll share my work here too, if you want to use my code.

This time it is about the following:

  • Add a command -B <YYYYMMDD> to pilerimport, which only imports mails older than the set date.

I'm already on it, and have choosen the following way to work:

  • Run a "SEARCH BEFORE [...]"-query on the IMAP-Server before the contents of folders are fetched.

  • Don't fetch the whole folder contents from 0 to <message>, but rather only grab the mails by UIDs returned by the previous query.

Any ideas or objections about my solution are welcome.

Comments (7)

  1. Rico 'Xaneorath' Tröger reporter

    On a small sidenote: I think I found a mistake in pilerimport.c

    In the "static struct long_options[]" option "recursive" is flagged as "required_argument". I think it should be "no_argument" at that point.

  2. Jan Graczu

    It will be good to have option in pilerimport to set filter for: import email newer than <YYYYMMDD>

  3. Log in to comment