Working with Message Flags on Server

Changing the Message Flags

You can change message flags by using the ChangeMessageFlags() method. This method takes two parameters.

  1. The sequence number of a message or its unique ID.
  2. MessageFlag.

The following flags can be set:

Setting Message Flags

The following code snippet shows you how to change message flags on an IMAP server with Aspose.Email.

Removing Message Flags

Message flags can also be removed with the RemoveMessageFlags() method. Usage is similar to that of the ChangeMessageFlags() method. It takes a sequence number or unique message ID and MessageFlag. The following code snippet shows you how to remove message flags.

Setting Custom Flags

You can also set custom flags to a message using the ImapClient of the API. The ImapClient AddMessageFlags provides the ability to set custom flags on messages.