IMAP Mark Read
IMAP Mark Read
Section titled “IMAP Mark Read”Type: imap-mark-read · Package: SMTP / IMAP Email Activities v1.0.5
Marks an email as read on the IMAP server. Essential in processes that read unread emails: after processing each one you mark it as read so it is not picked up again in the next run. The change is stored on the server, so every client of that account sees it.
How it works
Section titled “How it works”Given the mailId (the .Id from IMAP Read), it adds the read flag to that email in folder. It is idempotent: marking an already-read email has no effect. If the UID does not exist in the folder, the server marks nothing and the activity ends without error.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
host | string | — | IMAP server. |
username | string | — | Username. |
password | credential | — | Password or App Password. Use credential("name")["password"]. |
mailId | string | — | Email UID (from email.Id). Must be numeric. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
port | int | 993 | IMAP port. |
folder | string | "INBOX" | Folder that holds the email (the same it was read from). |
security | string | "ssl" | Encryption: auto, none, ssl or starttls. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Invalid 'mailId'. It must be the numeric UID returned by imap-read. | mailId is not a number. Pass email.Id from IMAP Read. |
'mailId' is required. | The parameter is missing or the expression returned null. |
| Authentication, folder or connection error | Same as in IMAP Read. |
Example
Section titled “Example”IMAP Read host = "imap.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"] unreadOnly = true → output: emailsFor Each items = emails itemVariable = email └─ activities: Try / Catch errorVariable = error ├─ try: │ ... process ... │ IMAP Mark Read host = "imap.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"] mailId = email.Id └─ catch: Log level = warning message = "Still pending: " + email.Subject + " — " + error.Message