10 Apr
2015
10 Apr
'15
4:49 a.m.
On 04/09/2015 08:41 PM, Gedalya wrote:
doveadm user '*' | while read user; do doveadm search -u $user mailbox Junk all | while read guid uid; do doveadm -f flow fetch -u $user text mailbox-guid $guid uid $uid | sed s/^text=// | ssh -i /path/to/ssh-key root@$spamassassin-box "su -l -c 'spamassassin --report' $user" # expunge, so we don't repeat it if no other reason doveadm expunge -u $user mailbox-guid $guid uid $uid done done
Oh, actually doveadm search -A mailbox Junk all
returns 3 columns -
username, mailbox-guid, uid, so you don't need a separate command in the
outer loop iterating over usernames :P ..