> > -----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!