Recipes
These use jq to read fob-email's JSON. Each recipe works on one account; add --account <name> to the commands to choose another.
Download every invoice from a sender#
mkdir -p invoices
fob-email emails search --from [email protected] --since 2026-09-01 --json \
| jq -r '.[] | select(.hasAttachment) | .id' \
| while read -r id; do
fob-email emails download "$id" -o invoices
done
Attachments with the same file name overwrite each other. To keep them apart, download each message into its own folder: -o "invoices/$id".
File messages into a folder#
fob-email folders create Statements # once
fob-email emails search --subject "statement" --json \
| jq -r '.[].id' \
| while read -r id; do
fob-email emails move "$id" --to Statements
done
Every move happens straight away. Run the search on its own first and check the list.
Unread messages with attachments#
fob-email emails list --limit 200 --json \
| fob-email emails filter --unseen --has-attachment \
| jq -r '.[] | "\(.id)\t\(.from.addr)\t\(.subject)"'
Export the inbox to CSV#
fob-email emails list --limit 500 --json \
| jq -r '["id","date","from","subject"], (.[] | [.id, .date, .from.addr, .subject]) | @csv' \
> inbox.csv
Who emails you most#
fob-email emails list --limit 500 --json \
| jq -r 'group_by(.from.addr) | map({from: .[0].from.addr, count: length}) | sort_by(-.count) | .[:10][] | "\(.count)\t\(.from)"'
Send a report with attachments#
fob-email emails send --to [email protected] \
--subject "Invoices received, week $(date +%V)" \
--body-file summary.txt \
--attach invoices/INV-2291.pdf --attach invoices/INV-2304.pdf
Fast repeated searches from the local copy#
fob-email sync run --all-folders --limit 5000 # once, then again whenever you want fresh data
fob-email emails search --cached --from aws --since 2026-01-01
fob-email emails search --cached --subject receipt --folder Archive
See Local sync.