[Dovecot] getting rid of old spam from +spam Maildir ?
I'm trying to setup per user '+spam' delivery from amavis tags, so that each user gets any mails tagged as spam to 'spam' Maildir via +spam Dovecot lmtp delivery.
after say 7 days I want to delete all spams older than 7 days, if I simply delete mail files from the file system, is that a 'bad thing' ?
what is a proper way to do that, and scripts ?
for removing/archiving old uncollected emails in main INBOX I use archivemail from sf, but, don't think I can do subfoldrs with archivemail
any pointers (and scripts) welcomed, thanks
-- Voytek
Am 10.07.2012 13:25, schrieb Voytek Eymont:
I'm trying to setup per user '+spam' delivery from amavis tags, so that each user gets any mails tagged as spam to 'spam' Maildir via +spam Dovecot lmtp delivery.
i have no amavis, i use a global sieve rule to deliver tagged mail into special Junk folder, and virtual plugin to get users the chance to download tagged mails from Junk folder via pop3 too
look i.e here
http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples
after say 7 days I want to delete all spams older than 7 days, if I simply delete mail files from the file system, is that a 'bad thing' ?
perhaps use daily cron with something like this
doveadm expunge -A mailbox Junk savedbefore 7d;
what is a proper way to do that, and scripts ?
for removing/archiving old uncollected emails in main INBOX I use archivemail from sf, but, don't think I can do subfoldrs with archivemail
any pointers (and scripts) welcomed, thanks
i am not sure what you ask for here, looking for archive solution ?
-- Best Regards MfG Robert Schetterer
Am 10.07.2012 13:34, schrieb Robert Schetterer:
Am 10.07.2012 13:25, schrieb Voytek Eymont:
I'm trying to setup per user '+spam' delivery from amavis tags, so that each user gets any mails tagged as spam to 'spam' Maildir via +spam Dovecot lmtp delivery.
i have no amavis, i use a global sieve rule to deliver tagged mail into special Junk folder, and virtual plugin to get users the chance to download tagged mails from Junk folder via pop3 too
look i.e here
http://wiki2.dovecot.org/Pigeonhole/Sieve/Examples
after say 7 days I want to delete all spams older than 7 days, if I simply delete mail files from the file system, is that a 'bad thing' ?
perhaps use daily cron with something like this
doveadm expunge -A mailbox Junk savedbefore 7d;
i forgot read
http://wiki2.dovecot.org/Plugins/Expire
for this too
what is a proper way to do that, and scripts ?
for removing/archiving old uncollected emails in main INBOX I use archivemail from sf, but, don't think I can do subfoldrs with archivemail
any pointers (and scripts) welcomed, thanks
i am not sure what you ask for here, looking for archive solution ?
-- Best Regards MfG Robert Schetterer
On Tue, July 10, 2012 9:34 pm, Robert Schetterer wrote:
perhaps use daily cron with something like this
doveadm expunge -A mailbox Junk savedbefore 7d;
where am I going wrong ?
nothing gets removed:
# pwd /var/mail/vhosts/sbt.net.au/spam@sbt.net.au/.spam/cur # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 7day # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 7d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 5d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 4d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 3d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 2d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 1d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 1w # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox .spam savedbefore 1w # ls | wc 532 532 30884
ls -al -rw------- 1 vmail vmail 5921 Jul 9 21:55 1341834948.M445074P17475.geko.sbt.net.au,S=5921,W=6003:2, -rw------- 1 vmail vmail 3021 Jul 9 22:06 1341835577.M701903P17756.geko.sbt.net.au,S=3021,W=3125:2, ....
-- Voytek
Am 03.08.2012 15:09, schrieb Voytek Eymont:
On Tue, July 10, 2012 9:34 pm, Robert Schetterer wrote:
perhaps use daily cron with something like this
doveadm expunge -A mailbox Junk savedbefore 7d;
where am I going wrong ?
nothing gets removed:
# pwd /var/mail/vhosts/sbt.net.au/spam@sbt.net.au/.spam/cur # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 7day # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 7d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 5d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 4d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 3d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 2d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 1d # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox spam savedbefore 1w # ls | wc 532 532 30884 # doveadm expunge -u spam@sbt.net.au mailbox .spam savedbefore 1w # ls | wc 532 532 30884
ls -al -rw------- 1 vmail vmail 5921 Jul 9 21:55 1341834948.M445074P17475.geko.sbt.net.au,S=5921,W=6003:2, -rw------- 1 vmail vmail 3021 Jul 9 22:06 1341835577.M701903P17756.geko.sbt.net.au,S=3021,W=3125:2, ....
do you use expire plugin ?
http://wiki2.dovecot.org/Plugins/Expire
-- Best Regards MfG Robert Schetterer
On Fri, August 3, 2012 11:14 pm, Robert Schetterer wrote:
do you use expire plugin ?
no... I saw this part:
"Note that: This command runs fine even without expire plugin loaded."
and assumed I didn't have to.... OK, back to drawing board, thanks for your help
-- Voytek Eymont
On 3.8.2012, at 16.09, Voytek Eymont wrote:
doveadm expunge -A mailbox Junk savedbefore 7d;
where am I going wrong ?
nothing gets removed:
Find out what Dovecot thinks the save dates are:
doveadm fetch -u user@domain date.saved mailbox spam
I'm pretty sure the problem is simply that the saved date isn't what you expect it to be. With maildir it's initially taken from the file's ctime and added to cache.
On Fri, August 3, 2012 11:42 pm, Timo Sirainen wrote:
On 3.8.2012, at 16.09, Voytek Eymont wrote:
doveadm expunge -A mailbox Junk savedbefore 7d; where am I going wrong ? nothing gets removed: Find out what Dovecot thinks the save dates are: doveadm fetch -u user@domain date.saved mailbox spam
Timo, thanks
I see...
date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09
I'm pretty sure the problem is simply that the saved date isn't what you expect it to be. With maildir it's initially taken from the file's ctime and added to cache.
so... what do I need ?
-- Voytek Eymont
On 3.8.2012, at 16.47, Voytek Eymont wrote:
Find out what Dovecot thinks the save dates are: doveadm fetch -u user@domain date.saved mailbox spam
Timo, thanks
I see...
date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09
I'm pretty sure the problem is simply that the saved date isn't what you expect it to be. With maildir it's initially taken from the file's ctime and added to cache.
so... what do I need ?
Are those dates changed all the time? The problem should get fixed eventually by itself, unless something else weird is going on.
On Fri, August 3, 2012 11:53 pm, Timo Sirainen wrote:
On 3.8.2012, at 16.47, Voytek Eymont wrote:
Find out what Dovecot thinks the save dates are: doveadm fetch -u user@domain date.saved mailbox spam
date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09 date.saved: 2012-08-03 22:44:09
I'm pretty sure the problem is simply that the saved date isn't what you expect it to be. With maildir it's initially taken from the file's ctime and added to cache.
so... what do I need ?
Are those dates changed all the time? The problem should get fixed eventually by itself, unless something else weird is going on.
thanks. don't know, looking this morning it shows like below, the 00:05:05 is probably last time I did 'ls'? I was doing 'ls' or web mail refresh, to see what gets removed from 'spam' box, before and after each attempt to expunge :
date.saved: 2012-08-03 00:05:05 date.saved: 2012-08-03 00:05:05 date.saved: 2012-08-03 00:05:05 date.saved: 2012-08-03 00:05:05 date.saved: 2012-08-03 06:45:33 date.saved: 2012-08-03 06:45:33 date.saved: 2012-08-03 17:42:26 date.saved: 2012-08-03 17:42:26 date.saved: 2012-08-03 17:42:26 date.saved: 2012-08-03 18:37:25 date.saved: 2012-08-03 18:55:34 date.saved: 2012-08-03 19:51:02 date.saved: 2012-08-04 02:45:21 date.saved: 2012-08-04 06:33:16
-- Voytek
On 2012-08-03 6:33 PM, Voytek Eymont voytek@sbt.net.au wrote:
don't know, looking this morning it shows like below, the 00:05:05 is probably last time I did 'ls'? I was doing 'ls' or web mail refresh, to see what gets removed from 'spam' box, before and after each attempt to expunge :
date.saved: 2012-08-03 00:05:05
The 'date.saved:' is the date/time that the message was moved into that folder.
The clock for these messages is based on the time it was moved into that folder, NOT the date/time the message was received in the message header. Maybe this is what is confusing you?
So, if you have issue the command to remove messages older than 7 days, that would be 7 days *since they were moved into the folder*.
--
Best regards,
Charles
On Mon, August 6, 2012 2:23 am, Charles Marcus wrote:
The 'date.saved:' is the date/time that the message was moved into that folder.
The clock for these messages is based on the time it was moved into that folder, NOT the date/time the message was received in the message header. Maybe this is what is confusing you?
So, if you have issue the command to remove messages older than 7 days, that would be 7 days *since they were moved into the folder*.
Charles,
thanks
these are a user+spam spam basket, the actual messages are either in 'new' or 'cur', depending if a particular user logged to 'spam' basket or not
does that mean that say 7 days would clear new messages after 7 days, and, any message that is not 'new' after 7 more days, assuming I run the command daily ?
all I want is an auto way to clear +spam baskets after x days
-- Voytek Eymont
On 2012-08-05 6:47 PM, Voytek Eymont voytek@sbt.net.au wrote:
On Mon, August 6, 2012 2:23 am, Charles Marcus wrote:
The 'date.saved:' is the date/time that the message was moved into that folder.
The clock for these messages is based on the time it was moved into that folder, NOT the date/time the message was received in the message header. Maybe this is what is confusing you?
So, if you have issue the command to remove messages older than 7 days, that would be 7 days *since they were moved into the folder*.
Charles,
thanks
these are a user+spam spam basket, the actual messages are either in 'new' or 'cur', depending if a particular user logged to 'spam' basket or not
does that mean that say 7 days would clear new messages after 7 days, and, any message that is not 'new' after 7 more days, assuming I run the command daily ?
all I want is an auto way to clear +spam baskets after x days
I'm not sure I understand your question...
Again, the date.saved is the date/tome the message was moved into the folder, and has nothing to do with the date the message was received or the date/time in the message header.
So, as long as the date.saved date/time is not older than the date/time you are searching on, then they will not be deleted.
--
Best regards,
Charles
Am 06.08.2012 00:47, schrieb Voytek Eymont:
On Mon, August 6, 2012 2:23 am, Charles Marcus wrote:
The 'date.saved:' is the date/time that the message was moved into that folder.
The clock for these messages is based on the time it was moved into that folder, NOT the date/time the message was received in the message header. Maybe this is what is confusing you?
So, if you have issue the command to remove messages older than 7 days, that would be 7 days *since they were moved into the folder*.
Charles,
thanks
these are a user+spam spam basket, the actual messages are either in 'new' or 'cur', depending if a particular user logged to 'spam' basket or not
does that mean that say 7 days would clear new messages after 7 days, and, any message that is not 'new' after 7 more days, assuming I run the command daily ?
all I want is an auto way to clear +spam baskets after x days
an ugly workaround maybe is ,thing like this, if using maidir
v1.0 cronjob equivalent
For Dovecot v1.0, this can be accomplished by running a daily shell script:
# delete 30 day old mails find /var/virtualmail/ -regex '.*/\.\(Trash\|Junk\)\(/.*\)?\/\(cur\|new\)/.*' -type f -ctime +30 -delete # or -exec rm '{}' \; instead of -delete
Using ctime means that messages are deleted 30 days after they've been moved to Trash. If mtime was used instead, it would mean the message is deleted 30 days after its original creation, which could be immediately.
but i recommend expire plugin, also Timos advices should work for sure
-- Best Regards MfG Robert Schetterer
Dovecot lmtp delivery.
after say 7 days I want to delete all spams older than 7 days, if I simply delete mail files from the file system, is that a 'bad thing' ?
i don't use lmtp so maybe i'm wrong but if you use maildir format just deleting/moving files always work properly
On 07/10/2012 01:25 PM, Voytek Eymont wrote:
I'm trying to setup per user '+spam' delivery from amavis tags, so that each user gets any mails tagged as spam to 'spam' Maildir via +spam Dovecot lmtp delivery.
after say 7 days I want to delete all spams older than 7 days, if I simply delete mail files from the file system, is that a 'bad thing' ? [...] IMHO 7 days is dangerously too short. False positives during vacations happen too ;-)
I would suggest at least 30 days (as used by Gmail).
if I simply delete mail files from the file system, is that a 'bad thing' ? [...] IMHO 7 days is dangerously too short. False positives during vacations happen too ;-)
I would suggest at least 30 days (as used by Gmail).
or use spam system that NEVER actually receive something it thinks it is spam, but provide proper SMTP response.
On 07/10/2012 07:11 PM, Wojciech Puchar wrote:
if I simply delete mail files from the file system, is that a 'bad thing' ? [...] IMHO 7 days is dangerously too short. False positives during vacations happen too ;-)
I would suggest at least 30 days (as used by Gmail).
or use spam system that NEVER actually receive something it thinks it is spam, but provide proper SMTP response.
I personally do not recommend rejecting cases (very) close to spam/ham border in SMTP session BUT IMHO accepting to many spams into spambox makes "final check by the recipient" a laughing stock/dangerous illusion.
is spam, but provide proper SMTP response.
I personally do not recommend rejecting cases (very) close to spam/ham border in SMTP session well i have very very low amount of misses
but consider generating meaningful SMTP response like "if you are not spammer call us, so we will fix it"
On 07/12/2012 12:29 PM, Wojciech Puchar wrote:
is spam, but provide proper SMTP response.
I personally do not recommend rejecting cases (very) close to spam/ham border in SMTP session well i have very very low amount of misses
but consider generating meaningful SMTP response like "if you are not spammer call us, so we will fix it"
- I personally do not like using ONLY binary choice [accept/reject (in SMTP session)]. I personally do prefer something for (small) range in between.
- IMHO senders' opinions are much less relevant than recipients' opinions for postmaster of receiving server. [received e.g. via antispam plug-in of dovecot (moving messages in/out spambox folder]
participants (6)
-
Andrzej A. Filip
-
Charles Marcus
-
Robert Schetterer
-
Timo Sirainen
-
Voytek Eymont
-
Wojciech Puchar