---
title: "set flags · RUAL Documentation"
description: "Marks messages read, unread, flagged, answered : or with a keyword of your own : by UID. A RUAL imap block. See its pins, canvas example and version history."
canonical: https://docs.rual.nl/block-types/imap/imapconnection_set_flags
language: en
---

[Cluster](https://docs.rual.nl/cluster)

[Blocks](https://docs.rual.nl/block-types)

[Interfaces](https://docs.rual.nl/interfaces)

[Blueprints](https://docs.rual.nl/blueprints)

[Blueprint Language](https://docs.rual.nl/engine)

[Tutorials](https://docs.rual.nl/tutorials)

[Home automation](https://docs.rual.nl/home-automation)

[Examples](https://docs.rual.nl/examples)

[Reference](https://docs.rual.nl/reference)

[Architecture](https://docs.rual.nl/architecture)

[Troubleshooting](https://docs.rual.nl/troubleshooting)

Other

# set flags

This block is part of the [`imap`](https://docs.rual.nl/block-types/imap) group and was last modified in core [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

Marks messages read, unread, flagged, answered : or with a keyword of your own : by UID.

- flow `flow`

- connection required `imapconnection`

- mailbox `value` Mailbox the uids belong to. Defaults to `INBOX`.

Default `INBOX`

- uids `array` UIDs to change.

- uid `number` A single UID, added to `uids`.

- action `value` `add` (default), `remove` or `set`. • Suggestions: `add` `remove` `set`

Default `add`

- flags required `array` `seen`, `answered`, `flagged`, `deleted`, `draft`, or a keyword such as `$Forwarded`.

- flow `flow`

- connection `imapconnection`

- success `condition`

- error `value`

- count `number`

Runs UID STORE on the uids in mailbox (default INBOX). action: 'add' (default) adds the flags, 'remove' clears them, 'set' REPLACES every flag on the message. flags is an array of 'seen', 'answered', 'flagged', 'deleted', 'draft', the IMAP spelling ('\\Seen') or a keyword ('$Forwarded', 'Invoiced'). To mark as read: action add, flags [seen]; to mark unread: action remove, flags [seen]. count reports the uids the command covered. Suppressed in a simulation.

| `mark read` |
| --- |
| `mark unread` |
| `flag email` |
| `imap store` |

A typical wiring for [set flags](https://docs.rual.nl/block-types/imap/imapconnection_set_flags): a [function trigger](https://docs.rual.nl/block-types/globals/trigger_custom_function) starts the flow; [move messages](https://docs.rual.nl/block-types/imap/imapconnection_move) feeds the `connection` pin; [with values](https://docs.rual.nl/block-types/array/array_of_values) feeds the `flags` pin; the `flow` out pin feeds [debug](https://docs.rual.nl/block-types/state%2520ui/state_debug).

[![Studio canvas example for the set flags block: typical wiring for set flags.](https://docs.rual.nl/canvas-examples/imapconnection_set_flags.png)](https://docs.rual.nl/canvas-examples/imapconnection_set_flags.png?v=3)

## Version history

Introduced in [`v15.0.1`](https://docs.rual.nl/core-versions/150001).

- [Back to `imap`](https://docs.rual.nl/block-types/imap): Return to the main group to view all sub-groups

- [Back to `imap`](https://docs.rual.nl/block-types/imap?group=imap): Return to the group to view all blocks within this group

Was this page helpful? [Tell us what to improve](https://docs.rual.nl/support) · RUAL Docs is an integral component of the [RUAL ecosystem](https://rual.nl)
