[Dovecot] Is it safe to manipulate Maildir files directly?
Oli Schacher
dovecot at lists.wgwh.ch
Tue Nov 5 09:40:31 EET 2013
On Mon, 4 Nov 2013 21:49:59 -0800
David Henkel-Wallace <gumby at henkel-wallace.org> wrote:
> Having the cron job find the messages and train spamassassin is no
> problem. The question is how to move the messages. Is it safe to
> simply rename the files from my cron job?
>
[...]
> If I have to go through to Dovecot I am afraid I'd need the user's
> credentials, which is not appropriate.
>
you can do all this with doveadm scripts.
http://wiki2.dovecot.org/Tools/Doveadm
Something like this should work:
doveadm search -A mailbox 'hamreport' 2>/dev/null | while read
user guid uid; do doveadm fetch -u $user text mailbox-guid $guid uid
$uid | sa-learn --ham ; doveadm move -u $user INBOX mailbox-guid $guid
uid $uid ; done
this should fetch all mails in the 'hamreport' folder of every user,
pass it to sa-learn and then move it to the user's INBOX
you don't need the user credentials , but you have to make sure
doveadm can find all users (iterate_query setting with SQL auth db)
hth
Oli
--
message transmitted on 100% recycled electrons
More information about the dovecot
mailing list