.TH "DOVEADM-FLAGS" "1" "May 2026" "e5ac02a" "Dovecot" .SH "NAME" \fBdoveadm-flags\fR - Add, remove or replace messages' flags .SH "SYNOPSIS" .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] \fBflags\fR \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fB-A\fR \fIcommand flags\fR \fIsearch_query\fR .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] \fBflags\fR \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fB-F\fR \fIfile\fR \fIcommand flags\fR \fIsearch_query\fR .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] \fBflags\fR \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fB--no-userdb-lookup\fR \fIcommand flags\fR \fIsearch_query\fR .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] \fBflags\fR \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fB-u\fR \fIuser\fR \fIcommand flags\fR \fIsearch_query\fR .SH "DESCRIPTION" .P This command is used to manipulate flags of messages. .SH "GLOBAL OPTIONS" .P Global doveadm(1) \fIoptions\fR: .P \fB-D\fR .RS 0 .RS 4 .P Enables \fIverbosity\fR and debug messages. .RE 0 .RE 0 .P \fB-O\fR .RS 0 .RS 4 .P Do not read any config file, just use defaults. The \fBdovecot_storage_version\fR setting defaults to the latest version, but can be overridden with \fB-o\fR. .RE 0 .RE 0 .P \fB-k\fR .RS 0 .RS 4 .P Preserve entire environment for doveadm, not just \fBimport_environment\fR setting. .RE 0 .RE 0 .P \fB-v\fR .RS 0 .RS 4 .P Enables verbosity, including progress counter. .RE 0 .RE 0 .P \fB-i\fR \fIinstance-name\fR .RS 0 .RS 4 .P If using multiple Dovecot instances, choose the config file based on this instance name. .P See \fBinstance_name\fR setting for more information. .RE 0 .RE 0 .P \fB-c\fR \fIconfig-file\fR .RS 0 .RS 4 .P Read configuration from the given \fIconfig-file\fR. By default it first reads config socket, and then falls back to \fI/etc/dovecot/dovecot.conf\fR. You can also point this to config socket of some instance running compatible version. .RE 0 .RE 0 .P \fB-o\fR \fIsetting\fR\fB=\fR\fIvalue\fR .RS 0 .RS 4 .P Overrides the configuration \fIsetting\fR from \fI/etc/dovecot/dovecot.conf\fR and from the userdb with the given \fIvalue\fR. In order to override multiple settings, the \fB-o\fR option may be specified multiple times. .RE 0 .RE 0 .SH "OPTIONS" .P \fB-A\fR .RS 0 .RS 4 .P If the \fB-A\fR option is present, the \fIcommand\fR will be performed for all users. Using this option in combination with system users from \fBuserdb { driver = passwd }\fR is not recommended, because it contains also users with a lower UID than the one configured with the \fBfirst_valid_uid\fR setting. .P When the SQL userdb module is used, make sure that the \fBuserdb_sql_iterate_query\fR setting setting matches your database layout. .P When using the LDAP userdb module, make sure that the \fBuserdb_fields\fR setting and \fBuserdb_ldap_iterate_fields\fR setting settings match your LDAP schema. Otherwise doveadm(1) will be unable to iterate over all users. .RE 0 .RE 0 .P \fB-F\fR \fIfile\fR .RS 0 .RS 4 .P Execute the \fIcommand\fR for all the users in the \fIfile\fR. This is similar to the \fB-A\fR option, but instead of getting the list of users from the userdb, they are read from the given \fIfile\fR. The \fIfile\fR contains one username per line. .RE 0 .RE 0 .P \fB--no-userdb-lookup\fR .RS 0 .RS 4 .P Do not perform userdb lookup. Use the \fBUSER\fR environment variable to specify the username. .RE 0 .RE 0 .P \fB-S\fR \fIsocket_path\fR .RS 0 .RS 4 .P The option's argument is either an absolute path to a local UNIX domain socket, or a hostname and port (\fIhostname\fR:\fIport\fR), in order to connect a remote host via a TCP socket. .P This allows an administrator to execute doveadm(1) mail commands through the given socket. .RE 0 .RE 0 .P \fB-u\fR \fIuser/mask\fR .RS 0 .RS 4 .P Run the \fIcommand\fR only for the given \fIuser\fR. It's also possible to use '\fB*\fR' and '\fB?\fR' wildcards (e.g. -u *@example.org). .RE 0 .RE 0 .SH "ARGUMENTS" .P \fIflags\fR .RS 0 .RS 4 .P Message flags as described in RFC 3501, section 2.3.2 (Flags Message Attribute): \fB\[rs]Answered\fR, \fB\[rs]Deleted\fR, \fB\[rs]Draft\fR, \fB\[rs]Flagged\fR, \fB\[rs]Recent\fR and \fB\[rs]Seen\fR. And the IMAP keywords \fB$Forwarded\fR, \fB$MDNSent\fR, \fB$SubmitPending\fR and \fB$Submitted\fR or user-defined keywords, e.g. \fBJunk\fR, \fB$NonSpam\fR or \fB$Label1\fR. .P One or multiple flags and/or keywords can be specified. .RE 0 .RE 0 .P \fIsearch_query\fR .RS 0 .RS 4 .P Manipulate the flags of messages matching the given search query. See doveadm-search-query(7) for details. .RE 0 .RE 0 .SH "COMMANDS" .SS "flags add" .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] flags add \[lB]\fB-u\fR \fIuser\fR | \fB-A\fR | \fB-F\fR \fIfile\fR | \fB--no-userdb-lookup\fR\[rB] \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fIflags search_query\fR .P This command is used to extend the current set of flags with the given \fIflags\fR. .SS "flags remove" .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] flags remove \[lB]\fB-u\fR \fIuser\fR | \fB-A\fR | \fB-F\fR \fIfile\fR | \fB--no-userdb-lookup\fR\[rB] \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fIflags search_query\fR .P In order to remove the given \fIflags\fR from the current set of flags, use this command. .SS "flags replace" .P \fBdoveadm\fR \[lB]\fIGLOBAL OPTIONS\fR\[rB] flags replace \[lB]\fB-u\fR \fIuser\fR | \fB-A\fR | \fB-F\fR \fIfile\fR | \fB--no-userdb-lookup\fR\[rB] \[lB]\fB-S\fR \fIsocket_path\fR\[rB] \fIflags search_query\fR .P This command is used to replace ALL current flags with the given \fIflags\fR. .SH "EXAMPLE" .P List and manipulate the message flags of the message with uid 81563: .P .RS 2 .nf doveadm fetch -u bob 'uid flags' mailbox dovecot uid 81563 .fi .RE .P .RS 2 .nf uid: 81563 flags: \[rs]Answered \[rs]Seen NonJunk .fi .RE .P .RS 2 .nf doveadm flags remove -u bob NonJunk mailbox dovecot uid 81563 doveadm flags add -u bob '\[rs]Flagged $Forwarded' mailbox dovecot uid 81563 .fi .RE .SH "REPORTING BUGS" .P Report bugs, including \fIdoveconf -n\fR output, to the Dovecot Mailing List \fI\(ladovecot@dovecot.org\(ra\fR. Information about reporting bugs is available at: \fI\(lahttps://dovecot.org/bugreport.html\(ra\fR .SH "SEE ALSO" .P doveadm(1)