Browse the docs

Read the selected mail

Reads the message selected in Mail: its subject, who sent it, when it arrived, and a link that opens it again.

Read the selected mail into into

Examples #

Say which message is selected
When
  1. Press ⌃⌥M
Do
  1. Read the selected mail
  2. Show a notification “{{ subject }}”
Open in Switchboard to try it
Tell me when nothing is selected
When
  1. Press ⌃⌥M
Do
  1. Read the selected mail → message
  2. Copy “{{ message.link }}” to the clipboard
Open in Switchboard to try it

Details #

Reads the message that is selected in Mail, without changing it. When several are selected, it reads the first one. The step leaves these variables, and its output holds the same as one record:

VariableWhat it holds
subjectThe subject. Empty when the message has none.
senderWho sent it, as Mail shows it: Maya Lin <[email protected]>.
senderNameJust the name: Maya Lin. Empty when the message only has an address.
senderAddressJust the address: [email protected].
dateWhen it arrived, as an ISO 8601 date in your time zone. Use formatDate(date, "medium") to write it for people.
messageIdThe message's Message-ID, without the angle brackets.
linkA message:// link. Opening it shows the message in Mail, so put it in a to-do, a note or an event.
selectedCountHow many messages were selected.

Give it an into name and the whole message is also kept as one record in that variable.

Parameters #

ParameterTypeRequiredValuesWhat it does
intotextOptional. A variable that receives the whole message.

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

Gotchas #

  • It reads what is selected in Mail's viewer window, wherever Mail is on screen. It never opens Mail: with Mail closed, the step fails and says so.

  • With no message selected, the step fails with "No message is selected in Mail." Use onFailure: branch to tell the person instead of stopping.

  • Dry run. Mail is not read. The step answers with a sample message ("Quarterly report" from Maya Lin), so the steps after it get real-looking values.

See also #

Set mail status, Read the mail being written, Get the current thing, App Kits