Browse the docs

Set mail status

Marks the messages selected in Mail as read, flagged, junk, deleted or archived.

Mark the selected mail as status

Keyboard Maestro: SetMailStatus

Details #

Applies one change to every message that is selected in the Mail app right now. It does not search for messages and does not look at which message a rule or trigger started from; whatever is highlighted in Mail is what changes.

The status is one of:

  • read and unread set the read state.

  • flag and unflag set the flag.

  • junk and notJunk set the junk state.

  • delete deletes the message (it goes to Mail's Trash).

  • archive moves the message to the "Archive" mailbox of the message's own account.

Matching ignores case, spaces and dashes, and a few other names are accepted: flagged, unflagged, markAsJunk and trash.

The output is the number of messages changed. The Trace note reads like marked 3 messages read.

Parameters #

ParameterTypeRequiredValuesWhat it does
statustextYesRequired. read, unread, flag, unflag, junk, notJunk, delete or archive.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Mark the selected mail as read (dry run only simulates it)
Do
  1. Mark the selected mail read
  2. Show “Marked as read”
Open in Switchboard to try it

Gotchas #

  • Fails with no message is selected in Mail when nothing is selected, even though Mail itself was reached.

  • Fails with unknown mail status "<x>" and lists the allowed values for anything else.

  • delete and archive move real mail. Check the selection before you run a macro that does either.

  • archive needs a mailbox named "Archive" on the message's account. If there isn't one, Mail reports an error and the step fails.

  • The first run asks for permission to control Mail (System Settings > Privacy & Security > Automation).

See also #

Send mail, Send message