Sending and changing mail
These commands change your mailbox. Each one acts on one message, draft or folder, and each prints what it did.
Try it on a test mailbox first
Changes happen on your mail server immediately and sync to your other devices. Deletes can't be undone. If you're scripting changes, run them against a throwaway mailbox before your real one.
Video coming soon
Doing tasks with fob-email: file invoices, download attachments, send a report (3–4 min)
Mark, move and delete#
fob-email emails mark 1423 --read # or --unread
fob-email emails move 1423 --to Invoices/2026
fob-email emails delete 1423 --yes
- Pass
--folderif the message isn't inINBOX: IDs belong to a folder. See Message IDs. movegives the message a new ID in the destination folder.deleteremoves the message permanently, without moving it to Trash first. To keep a copy,moveit to your Trash folder instead (fob-email folders listshows its name).- Gmail applies its own rule to IMAP deletes, set under Settings → Forwarding and POP/IMAP. With the default, a message deleted from
INBOXis archived rather than erased.
Send an email#
Sending needs the account's SMTP server (Connect a mailbox). Without one, send stops with an error saying so.
fob-email emails send \
--to [email protected] --cc [email protected] \
--subject "September vendor invoices" \
--body-file summary.txt \
--attach invoices/INV-2291.pdf --attach invoices/INV-2304.pdf
--to,--cc,--bccand--attachcan each be repeated.- The body is plain text, from
--bodyor--body-file(not both). - The message is sent from the account's SMTP username (the IMAP username, unless you set
--smtp-user). - fob-email doesn't add a copy to your Sent folder. Gmail adds one automatically; other providers may not.
- If the server refuses some recipients, they're listed on stderr under
Rejected:. The rest are sent.
There's no reply or forward command yet, so a message sent with send starts a new conversation.
Drafts#
fob-email drafts create --to [email protected] --subject "Q3 close" --body "Draft notes…"
fob-email drafts list
fob-email drafts edit 88 --to [email protected] --subject "Q3 close (v2)" --body-file notes.txt
fob-email drafts send 88
fob-email drafts delete 88 --yes
- Drafts take the same options as
emails send. They're saved in your provider's Drafts folder (for Gmail,[Gmail]/Drafts) with the IMAP draft flag, so your mail app shows them like any other draft. editreplaces the whole draft, so pass every field again, including--to. The draft gets a new ID, whicheditprints.sendsends the draft as saved, then removes it from Drafts.
Before 0.2.0, drafts always used a folder named exactly Drafts, which fails on Gmail. Update with npm install -g @finopsbricks/fob-email@latest.
Folders#
fob-email folders create Invoices/2026
fob-email folders rename Invoices/2026 --to Archive/Invoices-2026
fob-email folders delete Archive/Invoices-2026 --yes
- Use
/to nest folders. A few servers use.instead;folders listshows how yours names nested folders. renamecan also move a folder under a new parent.- Deleting a folder deletes the messages in it. On Gmail, folders are labels: deleting one removes the label, and the messages stay in All Mail.