
# Sending and changing mail

These commands change your mailbox. Each one acts on one message, draft or folder, and each prints what it did.

<Callout type="warning" title="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.
</Callout>

<Video title="Doing tasks with fob-email: file invoices, download attachments, send a report (3–4 min)" />

## Mark, move and delete

```bash
fob-email emails mark 1423 --read            # or --unread
fob-email emails move 1423 --to Invoices/2026
fob-email emails delete 1423 --yes
```

- Pass `--folder` if the message isn't in `INBOX`: IDs belong to a folder. See [Message IDs](/docs/email/cli/reading-mail#message-ids).
- `move` gives the message a new ID in the destination folder.
- `delete` removes the message permanently, without moving it to Trash first. To keep a copy, `move` it to your Trash folder instead (`fob-email folders list` shows its name).
- **Gmail** applies its own rule to IMAP deletes, set under **Settings → Forwarding and POP/IMAP**. With the default, a message deleted from `INBOX` is archived rather than erased.

## Send an email

Sending needs the account's SMTP server ([Connect a mailbox](/docs/email/connect#2-add-the-account)). Without one, `send` stops with an error saying so.

```bash
fob-email emails send \
  --to finance@example.com --cc cfo@example.com \
  --subject "September vendor invoices" \
  --body-file summary.txt \
  --attach invoices/INV-2291.pdf --attach invoices/INV-2304.pdf
```

- `--to`, `--cc`, `--bcc` and `--attach` can each be repeated.
- The body is plain text, from `--body` or `--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

```bash
fob-email drafts create --to finance@example.com --subject "Q3 close" --body "Draft notes…"
fob-email drafts list
fob-email drafts edit 88 --to finance@example.com --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.
- **`edit` replaces the whole draft**, so pass every field again, including `--to`. The draft gets a new ID, which `edit` prints.
- **`send`** sends 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

```bash
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 list` shows how yours names nested folders.
- `rename` can 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.
