Discuss this help topic in SecureBlackbox Forum

IMAP: Update message state on the server

Store() method lets you update the state of one or several messages on the server.

The first and second parameters define either the numbers or UIDs of the first and last message, whose information is to be updated. If the values are equal, information about one message is retrieved. The SBIMAPClient.Unit.imapLastMessage constant can be passed instead of the last message number to denote the last message available in the mailbox.

Whether the are numbers or UIDs are passed in the first and second parameters, is determined by the third parameter, named UID. Setting it to true means that the UIDs are passed, while setting it to false means that the numbers are passed. The difference is that the numbers can change (eg. due to deletion of the message) while UIDs are permanent at least during the session.

Operation parameter specifies, whether flags must be added (set), replaced or removed.

Flags parameter lets you specify which flags are to be changed. The flags are:

  • imapAnsweredFlag - the message has been answered;
  • imapFlaggedFlag - the message is flagged (marked as important or with an asterisk) on the server;
  • imapDeletedFlag - the message is marked for deletion on the server;
  • imapSeenFlag - the message has been read;
  • imapDraftFlag - the message is a draft

Silent parameter specifies whether the server must omit any response (when the parameter is true) or it must return the numbers of UIDs of the updated messages and new values of the flags in the last, optional, Response parameter.

Examples:

C#:


    client.Store(UID, UID, true, TSBIMAPStoreFlagsOperation.imapAddFlags, SBIMAPClient.Unit.imapDeletedFlag, true, null);
Delphi:

  Client.Store(UID, UID, True, imapAddFlags, [imapDeletedFlag], True, nil);

How To articles about IMAP client

Discuss this help topic in SecureBlackbox Forum