[Dovecot] changing flags automatically
Timo Sirainen
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:
> Hello,
>
> (2.2:) there is no doveadm subcommand to change flags of messages, is it?
Nope.
> 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
> do
> echo $i" UID STORE "$u" flags (\Seen)"
> i=$((i+1));
> done
> 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
mailing list