search
This block is part of the imap group and was last modified in core v15.0.1.
search v15.0.1 Finds messages in a mailbox and returns their UIDs, newest first. Wire the UIDs into imap fetch to read them. Every criterion that is filled must match.
- flow
flow - connection required
imapconnection - mailbox
valueMailbox to search. Defaults to
INBOX. - unseen only
conditionOnly messages not yet marked read.
- flagged only
conditionOnly starred / flagged messages.
- answered only
conditionOnly messages marked answered.
- from
valueSubstring of the From header.
- to
valueSubstring of the To header.
- subject
valueSubstring of the Subject header.
- text
valueSubstring anywhere in the message, headers included.
- body
valueSubstring of the body only.
- since
valueArrived on or after this date. ISO date, RFC 3339,
dd-mm-yyyyor epoch. - before
valueArrived before this date (exclusive).
- larger than bytes
numberOnly messages larger than this many bytes.
- smaller than bytes
numberOnly messages smaller than this many bytes.
- header name
valueMatch one header, e.g.
List-Id. Needsheader value. - header value
valueSubstring the named header must contain.
- uid after
numberOnly uids greater than this : pass the highest uid handled last run to poll incrementally.
- limit
numberKeep at most this many uids after ordering. 0 keeps all.
- newest first
conditionOrder uids newest first (default). Off orders oldest first.
- flow
flow - connection
imapconnection - success
condition - error
value - uids
array - count
number - uid validity
number - uid next
number - messages in mailbox
number
Runs UID SEARCH in mailbox (default INBOX) and outputs uids[] (numbers, newest first unless newest_first=false), count, uid_validity, uid_next and messages (the mailbox total). Criteria are ANDed: unseen/flagged/answered (conditions), from/to/subject/text/body (substring, case-insensitive, as the server matches), since/before (arrival date; before is exclusive; ISO date, RFC 3339, dd-mm-yyyy or epoch), larger/smaller (bytes), header_name+header_value, and uid_after : uids strictly greater than a remembered cursor, the incremental-poll criterion. limit cuts the list AFTER ordering, so limit 10 is the ten newest. Polling pattern: remember the highest uid you handled together with uid_validity; next run pass uid_after=that uid, and if uid_validity changed, the server reset the mailbox and your cursor means nothing : start over. A search that matches nothing is success=true with count 0. Suppressed in a simulation.
find emails |
unread |
imap search |
poll inbox |
A typical wiring for search: 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 