[Dovecot] changing flags automatically
tss at iki.fi
Thu Mar 28 17:07:33 EET 2013
On Thu, 2013-03-28 at 14:56 +0100, Lutz Preßler wrote:
> (2.2:) there is no doveadm subcommand to change flags of messages, is it?
> The following should work reliably?
> # mark messages with subject $SUBJECT in mailbox $MAILBOX of user $USERID as read
> ( i=2
> echo "1 SELECT "$MAILBOX
> doveadm search -u $USERID mailbox $MAILBOX subject "$SUBJECT" \
> | while read g u
> echo $i" UID STORE "$u" flags (\Seen)"
> echo "0 LOGOUT"
> ) | /usr/lib/dovecot/imap -u $USERID
I guess it does, but a much easier way:
printf "a select $MAILBOX\nb search return (save) subject \"$SUBJECT
\""\n3 store $ +flags \\seen\n" | doveadm exec imap -u $USERID
You probably want +flags, not flags, so it won't touch non-seen flags.
More information about the dovecot