RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
-Original Message- From: Tom Collins [mailto:t...@tomlogic.com] Sent: November-12-12 1:51 PM To: qmailadmin@inter7.com Subject: Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age Just want to throw out there that different email clients will use different names for their deleted items. I'm using a cron job to clean up the Trash, Deleted Messages and Deleted Items folders, including any folder that starts with those strings. Survey your system and see what variations you find. I decided not to share my Perl script, since it uses the file date (Perl's -M which returns days between script start time and file modification time), not the date it was moved into the Trash folder. Hmm. I just did some quick tests and it looks like I should use -C (days since file change time) to trigger of the timestamp of when the file was moved to the trash. So, here's my script. Interested in feedback. I have it in my /etc/cron.daily so it runs every night. The file globs take care of directory hashing for both domains and users. I figured this was more efficient than recursing through the domain list, getting a domain's home directory, recursing through the user list and then processing the files. -Tom #!/usr/bin/perl $|++; $days = 45; @globs = ( '*/*/Maildir/.Trash*/{cur,new}', '?/*/*/Maildir/.Trash*/{cur,new}', '*/?/*/Maildir/.Trash*/{cur,new}', '?/*/?/*/Maildir/.Trash*/{cur,new}', '*/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '?/*/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '*/?/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '?/*/?/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}' ); $c = 0; print Deleting mail in .Trash and .Deleted Messages folders, over $days days old.\n; foreach $path (@globs) { while ($name = glob ('/home/vpopmail/domains/' . $path)) { opendir (D, $name) or print failed to open $name\n; while ($f = readdir(D)) { # skip non-files next if (! -f $name/$f); $t = -C $name/$f; if ($t $days) { unlink $name/$f; $c++; } } } } print Deleted $c messages over $days days old\n; Not sure if you saw some of the responses I got, but apparently if you don't use the expunge command, your quotas will not update. Someone can correct me if I misinterpreted this. Ofcourse if you're not using quotas, that won't matter. Otherwise your script seems to make sense based on my limited programming knowledge. In my case, I only want to empty the Trash that Squirrelmail uses for now, since its usually users that forget to purge it once they delete messages that I'm concerned with to start. In the rare case that they moved a message there by accident, I'll give it a 90 day window before its expunged. Matt !DSPAM:50a6391133991782415209!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch Just to update everyone. I did find a way to accomplish this even though we are using the vpopmail auth. I found this script online and modified it to fit my login info: -- #!/usr/local/bin/bash # MySQL details HOST=localhost; USER=vpopmail; PWD=vpopmail passwd; # Output sql to a file that we want to run echo USE vpopmail; select concat(pw_name,'@',pw_domain) as username from vpopmail; /tmp/query.sql; # Run the query and get the results results=`mysql -h $HOST -u $USER -p$PWD -N /tmp/query.sql`; # Loop through each row for row in $results do /usr/local/bin/doveadm expunge -u $row mailbox Trash savedbefore 52w done - Maybe this can help someone else who is in the same boat. Matt Rauch !DSPAM:50a0f90033991110759285!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Just want to throw out there that different email clients will use different names for their deleted items. I'm using a cron job to clean up the Trash, Deleted Messages and Deleted Items folders, including any folder that starts with those strings. Survey your system and see what variations you find. I decided not to share my Perl script, since it uses the file date (Perl's -M which returns days between script start time and file modification time), not the date it was moved into the Trash folder. Hmm… I just did some quick tests and it looks like I should use -C (days since file change time) to trigger of the timestamp of when the file was moved to the trash. So, here's my script. Interested in feedback. I have it in my /etc/cron.daily so it runs every night. The file globs take care of directory hashing for both domains and users. I figured this was more efficient than recursing through the domain list, getting a domain's home directory, recursing through the user list and then processing the files. -Tom #!/usr/bin/perl $|++; $days = 45; @globs = ( '*/*/Maildir/.Trash*/{cur,new}', '?/*/*/Maildir/.Trash*/{cur,new}', '*/?/*/Maildir/.Trash*/{cur,new}', '?/*/?/*/Maildir/.Trash*/{cur,new}', '*/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '?/*/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '*/?/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}', '?/*/?/*/Maildir/.Deleted\ {Messages,Items}*/{cur,new}' ); $c = 0; print Deleting mail in .Trash and .Deleted Messages folders, over $days days old.\n; foreach $path (@globs) { while ($name = glob ('/home/vpopmail/domains/' . $path)) { opendir (D, $name) or print failed to open $name\n; while ($f = readdir(D)) { # skip non-files next if (! -f $name/$f); $t = -C $name/$f; if ($t $days) { unlink $name/$f; $c++; } } } } print Deleted $c messages over $days days old\n; On Nov 12, 2012, at 8:21 AM, Matt Rauch wrote: Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch Just to update everyone. I did find a way to accomplish this even though we are using the vpopmail auth. I found this script online and modified it to fit my login info: -- #!/usr/local/bin/bash # MySQL details HOST=localhost; USER=vpopmail; PWD=vpopmail passwd; # Output sql to a file that we want to run echo USE vpopmail; select concat(pw_name,'@',pw_domain) as username from vpopmail; /tmp/query.sql; # Run the query and get the results results=`mysql -h $HOST -u $USER -p$PWD -N /tmp/query.sql`; # Loop through each row for row in $results do /usr/local/bin/doveadm expunge -u $row mailbox Trash savedbefore 52w done - Maybe this can help someone else who is in the same boat. Matt Rauch !DSPAM:50a11bf333991914119077!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Thanks everyone for the help. We're using qmail, Vpopmail, Dovecot and Squirrelmail. If there is something built in to Dovecot I could try that. The squirelmail plugin doesn't really look at the date of the message, and can only be set to remvoe entire trash after x number of days or x number of logins. I'll also have a look at Bill's script to see if I can apply it. So is the find command I listed not a sae way of going about it? Maybe Cron it for every 30 days or something? Matt -Original Message- From: Bob Miller [mailto:b...@computerisms.ca] Sent: November-07-12 10:28 PM To: qmailadmin@inter7.com Subject: Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age if you happen to be using dovecot, a good server-side soltuion is to set up doveadm to purge old messages using cron. On Wed, 2012-11-07 at 17:43 -0500, Matt Rauch wrote: Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch !DSPAM:509ba59a33991940411041!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Hi, I would run the script every day. Provided you make the changes as suggested it will only keep the last 30 days of messages in the trash and nothing more. Bill Bill http://www.goodcleanemail.com http://www.freebsdrocks.net http://www.centosrocks.net On Thu, Nov 8, 2012 at 10:24 AM, Matt Rauch mattr-li...@eagle.ca wrote: Thanks everyone for the help. We're using qmail, Vpopmail, Dovecot and Squirrelmail. If there is something built in to Dovecot I could try that. The squirelmail plugin doesn't really look at the date of the message, and can only be set to remvoe entire trash after x number of days or x number of logins. I'll also have a look at Bill's script to see if I can apply it. So is the find command I listed not a sae way of going about it? Maybe Cron it for every 30 days or something? Matt -Original Message- From: Bob Miller [mailto:b...@computerisms.ca] Sent: November-07-12 10:28 PM To: qmailadmin@inter7.com Subject: Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age if you happen to be using dovecot, a good server-side soltuion is to set up doveadm to purge old messages using cron. On Wed, 2012-11-07 at 17:43 -0500, Matt Rauch wrote: Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch !DSPAM:509ba6b133991297616107!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Il 08/11/2012 16:24, Matt Rauch ha scritto: Thanks everyone for the help. We're using qmail, Vpopmail, Dovecot and Squirrelmail. If there is something built in to Dovecot I could try that. The squirelmail plugin doesn't really look at the date of the message, and can only be set to remvoe entire trash after x number of days or x number of logins. I'll also have a look at Bill's script to see if I can apply it. So is the find command I listed not a sae way of going about it? Maybe Cron it for every 30 days or something? The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao -- Alessio Cecchi is: @ ILS - http://www.linux.it/~alessice/ on LinkedIn - http://www.linkedin.com/in/alessice Assistenza Sistemi GNU/Linux - http://www.cecchi.biz/ @ PLUG - ex-Presidente, adesso senatore a vita, http://www.prato.linux.it !DSPAM:509bab9533991856465116!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). Thanks, Matt !DSPAM:509bb1a333991409610720!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? -- Alessio Cecchi is: @ ILS - http://www.linux.it/~alessice/ on LinkedIn - http://www.linkedin.com/in/alessice Assistenza Sistemi GNU/Linux - http://www.cecchi.biz/ @ PLUG - ex-Presidente, adesso senatore a vita, http://www.prato.linux.it !DSPAM:509bb89333999263299237!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? I'm not entirely sure to be honest with you. Are you able to tell from the output of dovecot -n? imap# dovecot -n # 2.0.9: /usr/local/etc/dovecot/dovecot.conf # OS: FreeBSD 6.0-RELEASE-p5 i386 auth_mechanisms = plain login cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ default_client_limit = 1005 default_login_user = dovecot default_process_limit = 500 disable_plaintext_auth = no dotlock_use_excl = yes first_valid_uid = 89 last_valid_uid = 89 log_path = /dev/stderr log_timestamp = passdb { args = webmail=127.0.0.1 driver = vpopmail } plugin { quota = maildir } protocols = imap service auth { user = root } ssl_cert = /var/qmail/control/servercert.pem ssl_key = /var/qmail/control/servercert.pem userdb { args = quota_template=quota_rule=*:backend=%q driver = vpopmail } verbose_proctitle = yes Matt !DSPAM:509bbb4333991211014679!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
6.0 RELEASE? WOW That is one old box! Bill http://www.goodcleanemail.com http://www.freebsdrocks.net http://www.centosrocks.net On Thu, Nov 8, 2012 at 11:56 AM, Matt Rauch mattr-li...@eagle.ca wrote: Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? I'm not entirely sure to be honest with you. Are you able to tell from the output of dovecot -n? imap# dovecot -n # 2.0.9: /usr/local/etc/dovecot/dovecot.conf # OS: FreeBSD 6.0-RELEASE-p5 i386 auth_mechanisms = plain login cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ default_client_limit = 1005 default_login_user = dovecot default_process_limit = 500 disable_plaintext_auth = no dotlock_use_excl = yes first_valid_uid = 89 last_valid_uid = 89 log_path = /dev/stderr log_timestamp = passdb { args = webmail=127.0.0.1 driver = vpopmail } plugin { quota = maildir } protocols = imap service auth { user = root } ssl_cert = /var/qmail/control/servercert.pem ssl_key = /var/qmail/control/servercert.pem userdb { args = quota_template=quota_rule=*:backend=%q driver = vpopmail } verbose_proctitle = yes Matt !DSPAM:509bbb8533991985611242!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
-Original Message- From: Matt Rauch [mailto:mattr-li...@eagle.ca] Sent: November-08-12 11:57 AM To: qmailadmin@inter7.com Subject: RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? I'm not entirely sure to be honest with you. Are you able to tell from the output of dovecot -n? imap# dovecot -n # 2.0.9: /usr/local/etc/dovecot/dovecot.conf # OS: FreeBSD 6.0-RELEASE-p5 i386 auth_mechanisms = plain login cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ default_client_limit = 1005 default_login_user = dovecot default_process_limit = 500 disable_plaintext_auth = no dotlock_use_excl = yes first_valid_uid = 89 last_valid_uid = 89 log_path = /dev/stderr log_timestamp = passdb { args = webmail=127.0.0.1 driver = vpopmail } plugin { quota = maildir } protocols = imap service auth { user = root } ssl_cert = /var/qmail/control/servercert.pem ssl_key = /var/qmail/control/servercert.pem userdb { args = quota_template=quota_rule=*:backend=%q driver = vpopmail } verbose_proctitle = yes Matt Did some more digging and it looks like I can't use the -A flag if the userdb is vpopmail. I would have to bypass and use the sql directly. Not sure how I feel about that on a live mail server right now. Matt !DSPAM:509bc89b33991352880811!
RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
-Original Message- From: Matt Rauch [mailto:mattr-li...@eagle.ca] Sent: November-08-12 11:57 AM To: qmailadmin@inter7.com Subject: RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? I'm not entirely sure to be honest with you. Are you able to tell from the output of dovecot -n? imap# dovecot -n # 2.0.9: /usr/local/etc/dovecot/dovecot.conf # OS: FreeBSD 6.0-RELEASE-p5 i386 auth_mechanisms = plain login cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ default_client_limit = 1005 default_login_user = dovecot default_process_limit = 500 disable_plaintext_auth = no dotlock_use_excl = yes first_valid_uid = 89 last_valid_uid = 89 log_path = /dev/stderr log_timestamp = passdb { args = webmail=127.0.0.1 driver = vpopmail } plugin { quota = maildir } protocols = imap service auth { user = root } ssl_cert = /var/qmail/control/servercert.pem ssl_key = /var/qmail/control/servercert.pem userdb { args = quota_template=quota_rule=*:backend=%q driver = vpopmail } verbose_proctitle = yes Matt Did some more digging and it looks like I can't use the -A flag if the userdb is vpopmail. I would have to bypass and use the sql directly. Not sure how I feel about that on a live mail server right now. Matt I'm actually thinking none of these methods are going to accomplish my goal since the date it will use will be the received date of the file/message and not the date it went into Trash. So if a message was in the inbox for a year, and is moved to Trash today, and the script or whatever is run tonight, it will be removed and really only in the Trash for less then a day. Ideally I'd like to remove messages based on how long they have been in the Trash folder. Back to the drawing board. Matt !DSPAM:509bcf3f33991936316924!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Il 08/11/2012 18:53, Matt Rauch ha scritto: -Original Message- From: Matt Rauch [mailto:mattr-li...@eagle.ca] Sent: November-08-12 11:57 AM To: qmailadmin@inter7.com Subject: RE: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age Il 08/11/2012 17:15, Matt Rauch ha scritto: The best way to do this is to run: doveadm expunge -A mailbox Trash savedbefore 30d (if you use dovecot with MySQL for auth) or doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d (if you use dovecot with vpopmail auth) Any other script, like find -exec rm, will break user's quota since is not updating maildirsize file. Form more information see http://wiki2.dovecot.org/Tools/Doveadm/Expunge and http://wiki2.dovecot.org/Plugins/Expire Ciao Ok so I tested this method with search instead of expunge to see what would hit. if I try the first command (doveadm expunge -A mailbox Trash savedbefore 30d), I get an error message: # doveadm search -A mailbox Trash savedbefore 30d doveadm(mattr): Error: User listing returned failure doveadm: Error: Failed to iterate through some users If I use the second option (doveadm expunge -u u...@domain.com mailbox Trash savedbefore 30d) it works, but I have to specify the username for each user. Is there a way to do it so that it affects all users? (which I thought the -A would do). The -A need dovecot auth with mysql like this: ## vpopmail ## # Query to get a list of all usernames. iterate_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user FROM vpopmail # driver = mysql connect = host=localhost dbname=vpopmail user=vpopmail password=mypwd default_pass_scheme = MD5-CRYPT user_query = SELECT pw_dir as home, 89 AS uid, 89 AS gid, concat('*:backend=', pw_shell) as quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' password_query = SELECT CONCAT(pw_name, '@', pw_domain) AS user, pw_passwd AS password, concat('*:backend=', pw_shell) as userdb_quota_rule FROM vpopmail WHERE pw_name = '%n' AND pw_domain = '%d' What kind of dovecot authentication are you using? I'm not entirely sure to be honest with you. Are you able to tell from the output of dovecot -n? imap# dovecot -n # 2.0.9: /usr/local/etc/dovecot/dovecot.conf # OS: FreeBSD 6.0-RELEASE-p5 i386 auth_mechanisms = plain login cram-md5 auth_verbose = yes base_dir = /var/run/dovecot/ default_client_limit = 1005 default_login_user = dovecot default_process_limit = 500 disable_plaintext_auth = no dotlock_use_excl = yes first_valid_uid = 89 last_valid_uid = 89 log_path = /dev/stderr log_timestamp = passdb { args = webmail=127.0.0.1 driver = vpopmail } plugin { quota = maildir } protocols = imap service auth { user = root } ssl_cert = /var/qmail/control/servercert.pem ssl_key = /var/qmail/control/servercert.pem userdb { args = quota_template=quota_rule=*:backend=%q driver = vpopmail } verbose_proctitle = yes Matt Did some more digging and it looks like I can't use the -A flag if the userdb is vpopmail. I would have to bypass and use the sql directly. Not sure how I feel about that on a live mail server right now. With userdb in vpopmail you can't use -A At this page http://wiki2.dovecot.org/Plugins/Expire you can find a trick for do it: http://wiki2.dovecot.org/Plugins/Expire Ciao -- Alessio Cecchi is: @ ILS - http://www.linux.it/~alessice/ on LinkedIn - http://www.linkedin.com/in/alessice Assistenza Sistemi GNU/Linux - http://www.cecchi.biz/ @ PLUG - ex-Presidente, adesso senatore a vita, http://www.prato.linux.it !DSPAM:509c8c4c33996121420632!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Il 08/11/2012 19:22, Matt Rauch ha scritto: I'm actually thinking none of these methods are going to accomplish my goal since the date it will use will be the received date of the file/message and not the date it went into Trash. So if a message was in the inbox for a year, and is moved to Trash today, and the script or whatever is run tonight, it will be removed and really only in the Trash for less then a day. Ideally I'd like to remove messages based on how long they have been in the Trash folder. Back to the drawing board. Read about the Search Query available for doveadm: http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery -- Alessio Cecchi is: @ ILS - http://www.linux.it/~alessice/ on LinkedIn - http://www.linkedin.com/in/alessice Assistenza Sistemi GNU/Linux - http://www.cecchi.biz/ @ PLUG - ex-Presidente, adesso senatore a vita, http://www.prato.linux.it !DSPAM:509c8da033997247914056!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
Hello, Background: I created a website years and years ago called http://freebsdrocks.net for qmail so when you created users the spams would automatically go to the users' spam folder. After time the Spam folder would just continually build up. With some help from friends this script will train spamassassin for the spams in the .Spam folder and then delete anything over 30 days which is set as a default. If you want to use the same principal for the Trash, you will need to edit the following script http://wolson.dyndns.info/files/spamlearn.sh This may work in the same fashion but you will need to change the current functionality to delete the messages in the Trash folder and not the Spam folder and not train them with spamassassin. I would try this on a test box first :-) Bill Bill http://www.goodcleanemail.com http://www.freebsdrocks.net http://www.centosrocks.net On Wed, Nov 7, 2012 at 9:51 PM, William Olson wol...@gmail.com wrote: I can answer this tomorrow. I have a script at work that keeps the last 30 days of spams and it's customizable. You may just need to change .Spam to .Trash within the script. Bill Bill http://www.goodcleanemail.com http://www.freebsdrocks.net http://www.centosrocks.net On Wed, Nov 7, 2012 at 6:19 PM, Frank Chan fc...@molsci.org wrote: Hi Matt, If you referring to Squirrelmail webmail there is a plugin called Empty trash where you can configure when to purge the trash folder in Squirrelmail. Here is the link to the Squirrelmail plugin page to Empty Trash plugin: http://www.squirrelmail.org/**plugin_view.php?id=92http://www.squirrelmail.org/plugin_view.php?id=92 If this is not correct please specify which mail client you are referring to. I hope this helps, Frank On 07-11-2012 14:43, Matt Rauch wrote: Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch !DSPAM:509afa9f33995129038296!
Re: [qmailadmin] [SPAM] Auto-empty trash items older then a certain age
if you happen to be using dovecot, a good server-side soltuion is to set up doveadm to purge old messages using cron. On Wed, 2012-11-07 at 17:43 -0500, Matt Rauch wrote: Hello, Sorry if this isn't the place to ask, but I've looked all over and haven't managed to find a clear solution. I'm looking for a way to have items that have been in the user's .Trash folder for a certain period of time (lets say 30 days or older) removed automatically. I thought there must be built-in functionality for this, or a script someone has come up with to manage this sort of thing. I've see a squirrelmail plugin that does it based on number of logins or every x number of days, but it empties the whole trash and doesn't check each message's age individually. Any help would be greatly appreciated. Thanks, Matt Rauch !DSPAM:509afdbf33991822061207!