Find email folders

Email inbox
Find email folders
Success
Credentials(Email credentials)
Error
Pattern
Folders(Email folder[])

Description

Finds folders (mailboxes) on a mail server and returns them as an array of folder objects carrying name, full path, special-use role, and message and unseen counts where the server reports them. The pattern is an IMAP pattern where * matches across the folder hierarchy and % matches within one level; empty returns every folder. Branches on success/error.

When to use

Use Find email folders to discover how a mailbox is laid out before working with it. Servers disagree about both naming and hierarchy: the sent folder might be Sent, Sent Items, or INBOX.Sent, and the separator is / on some servers and . on others. Listing beats guessing.

Break a folder to read its fields. path is the full name to hand to Find emails or Move email; name is just the leaf segment, for display. role is the folder’s RFC 6154 special-use attribute — INBOX, SENT, DRAFTS, TRASH, JUNK, ARCHIVE, ALL, FLAGGED, or NONE for an ordinary user-created folder — which is the portable way to find, say, the sent folder without matching on names in whatever language the account uses.

messages and unseen are nullable. They come from a STATUS request the server may decline to answer, and are absent rather than zero when it does; run them through Default if null before doing arithmetic on them.

Pins

Input pins

Pin Type Default Notes
Credentials Email credentials — Email credentials produced by any of the three email credentials nodes.
Pattern string — IMAP mailbox pattern. `*` matches any characters including the hierarchy separator, `%` matches within one level only. Empty (the default) is treated as `*` and returns every folder. `INBOX/%` lists the direct children of the inbox.

Output pins

Pin Type Notes
Folders Email folder[] Folders on the server. Break an element to read its name, path, role, message and unseen counts, and exists flag. Feed a folder's `path` into Find emails, Move email, or Copy email.

Execution pins

Pin Direction
In Input
Success Output
Error Output

Example

Report unread counts across a shared mailbox every morning. Wire credentials into Find email folders with an empty Pattern, then For each over Folders. Break each one, run unseen through Default if null (fallback 0), and Concatenate path and the count into a line. Collect the lines with a local variable and send the digest with Send email.

See also