I guess the issues I still think are important:
- You shouldn't use dovecot.index as your marker file.
I gave up trying to use dovecot.index. Instead I look at each users ./new directory. If there are any messages over 6 months old I put there email address in file that tells exim to reject any new messages. Run the script in cron.daily so if they start using it again it will reactivate in 24 hours or less. Having to look at all messages in the ./new folders is significantly more CPU and I/O load though. Having run the script last night it seems to work fine. Audited some of email addresses it added to be blocked and none look out of place.
Glad to hear you've got something that's working for you.
For what it's worth, I'd look at the newest message in the ./cur folder, rather than the oldest in the ./new. (You want the last time the user
But most of my user POP3 and do not leave messages on server. I just check if there is a message over 6 months old in new.
looked at a message, not the first time the user got mail after being logged in.) The actual difference in times probably isn't an important detail when you're talking O(6 months).
But, the benefit is that you can get the timestamp for the last time the user read/deleted a message in ./cur simply by checking the change time of the ./cur directory. (rather than going through all its files)
Light bulb. Wish I had thought of that.
e.g. $ stat -c '%z (=%Z)' ~/Maildir/cur 2007-11-14 15:26:09.000000000 -0500 (=1195071992) $ stat -c '%z (=%Z)' ~/Maildir/cur/* | sort | tail -n 1 2007-11-14 15:26:09.000000000 -0500 (=1195071992)
Should make it fast enough to run in cron.hourly, depending on your number of users/mailboxes.
I am going to have to try this. I used find with -mtime to find all messages over 6 months old in all the ./new directorys. If this way works it would be far more efficient.
Thanks.
Matt