Re: [SPAM] Auto-empty trash items older then a certain age

Alessio Cecchi <[email protected]> Thu, 08 Nov 2012 17:45:31 +0100
Newsgroups gmane.mail.qmail.admin
Message-ID <[email protected]>
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 [email protected] 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 [email protected] 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!