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 two parameters define the first and the last messages to be updated. They can be either message sequence numbers or message UIDs, as defined by the third parameter, UID, of the call (set it to true if you provide UIDs and to false if you provide message sequence numbers). If the indices of the first and the last messages are equal, only one message is specified. The SBIMAPClient.Unit.imapLastMessage constant can be passed instead of the last message number to denote the last message available in the mailbox.

The difference between UIDs and message sequence numbers is that the latter can change (e.g. 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