fetch messages
This block is part of the imap group and was last modified in core v15.0.1.
fetch messages v15.0.1 Downloads messages by UID and parses each into the same object mail parse produces : addresses, subject, text, html, attachments, headers. Does not mark them read unless mark seen is on.
- flow
flow - connection required
imapconnection - mailbox
valueMailbox the uids belong to. Defaults to
INBOX. - uids
arrayUIDs to fetch : wire
imap search's uids here. At most 500 per fetch. - uid
numberA single UID, for the one-message case. Added to
uidswhen both are filled. - mark seen
conditionMark the fetched messages read. Off by default: reading leaves the mailbox as it was.
- headers only
conditionFetch the headers and skip bodies and attachments.
- include attachment content
conditionOn (the default) attachments carry
content_base64. Off gives name, type and size only. - max attachment bytes
numberPer-part ceiling on decoded attachment content. A larger part keeps its metadata and is reported with
truncated: true. - include raw
conditionAlso output the raw RFC 822 message per entry, for
imap appendor archiving. - max message bytes
numberA message larger than this is not downloaded: it is listed with
skippedset and nomessage. Ceiling 50 MB; one fetch pulls at most 100 MB in total.
- flow
flow - connection
imapconnection - success
condition - error
value - messages
array - first message
object - count
number
Fetches the given uids from mailbox (default INBOX) and outputs messages: [{ uid, flags[], seen, answered, flagged, deleted, draft, internal_date (epoch ms), size, message, parse_error, raw? }] plus count, and message = the first entry for the single-uid case. message is the mail_parse object: { from {name,email}, to[], cc[], reply_to[], subject, date, message_id, in_reply_to, references[], text, html, attachments[{name,content_type,size,content_base64,inline,cid}], headers, size, spam_score, authentication }. A message the parser cannot read is still listed with message=null and parse_error set, so a flow that moves or deletes what it handled never skips a uid. A uid the mailbox no longer holds is simply absent. mark_seen=false (default) uses BODY.PEEK and leaves unread state untouched : a flow polling 'unseen' must set it, or mark the uids with imap set flags, or it will see the same messages every run. headers_only=true fetches the header block only (no bodies, no attachments). include_content=false drops attachment bytes. include_raw=true adds the raw RFC 822 text. Bounds: at most 500 uids per fetch, a message over max_message_bytes (default 25 MB, ceiling 50 MB) is never downloaded, and one fetch pulls at most 100 MB in total; a message refused by either bound is STILL listed, with skipped set and message null, so a flow can move or delete it by uid without reading it : never silently omitted. headers_only fetches are exempt from the byte bounds. Suppressed in a simulation.
read emails |
download messages |
imap fetch |
get mail |
A typical wiring for fetch messages: a function trigger starts the flow; move messages feeds the connection pin; the flow out pin feeds debug.
Version history
Introduced in v15.0.1.
Back to
imap Return to the main group to view all sub-groups Back to imap Return to the group to view all blocks within this group 