Source: https://cli.nylas.com/guides/manage-email-drafts-cli

# Manage Email Drafts from Terminal

Sent email is permanent. Drafts give you a review gate between writing and delivery—inspect content, confirm recipients, and send only when you're ready. This guide covers the full draft lifecycle: create, list, inspect, send, and batch workflows from the terminal.

Written by [Nick Barraclough](https://cli.nylas.com/authors/nick-barraclough) Product Manager

Updated May 30, 2026

> **TL;DR:** Create a draft with `nylas email drafts create --to EMAIL --subject SUBJ --body BODY`, inspect it with `nylas email drafts show DRAFT_ID`, and deliver it with `nylas email drafts send DRAFT_ID`. Drafts sync to your provider’s Drafts folder so they’re visible in Gmail or Outlook webmail too.

## Why use drafts instead of sending directly?

A draft is an unsent email stored in your provider’s Drafts folder. It lets you separate the writing step from the delivery step. Once a message is delivered there’s no reliable recall — Gmail’s Undo Send buys at most 30 seconds, and Outlook message recall only works inside the same Exchange organization. A draft workflow catches a wrong name or a broken merge field before it reaches a recipient.

Drafts give you a window to verify the content, confirm the recipient address, and approve delivery explicitly. For scripts that generate emails automatically, that window is the difference between a polished send and an embarrassing one.

| Approach | Command | Best for |
| --- | --- | --- |
| Direct send | nylas email send | Alerts, notifications, automated reports where accuracy is guaranteed |
| Draft workflow | nylas email drafts create → send | Outbound campaigns, personalized follow-ups, anything that needs review |

## How do you install the CLI and authenticate?

Nylas CLI installs with a single Homebrew command on macOS and Linux. Authentication stores credentials locally in `~/.config/nylas/` so they persist across sessions. For other install methods (shell script, PowerShell, Go), see the [getting started guide](https://cli.nylas.com/guides/getting-started).

install.sh

File: `install.sh`

```bash
brew install nylas/nylas-cli/nylas

# Authenticate with an API key (headless / CI)
nylas auth config --api-key YOUR_API_KEY

# Or authenticate via browser (interactive)
nylas auth login
```

## How do you create an email draft from the terminal?

The `nylas email drafts create` command writes a draft to your provider’s Drafts folder without sending it. It accepts the recipient, subject, and body as flags. The draft appears within seconds and is immediately visible in Gmail or Outlook webmail. Both providers sync the `\Draft` IMAP flag and the Drafts mailbox in real time, as documented in [Gmail’s draft API reference](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users.drafts) and [Microsoft Graph’s Message resource](https://learn.microsoft.com/en-us/graph/api/resources/message).

The command returns a draft ID you’ll use in later steps to inspect or send the message. Pass `--json` to capture the full response including the ID, so you can pipe it into a variable or save it for batch workflows.

create-draft.sh

File: `create-draft.sh`

```bash
# Create a draft
nylas email drafts create \
  --to "alex@example.com" \
  --subject "Following up on our API conversation" \
  --body "Hi Alex — wanted to circle back on the integration timeline."

# Capture the draft ID as JSON
DRAFT=$(nylas email drafts create \
  --to "alex@example.com" \
  --subject "Following up on our API conversation" \
  --body "Hi Alex — wanted to circle back on the integration timeline." \
  --json)

echo "$DRAFT" | jq -r '.id'
```

## How do you list and inspect drafts?

The `nylas email drafts list` command returns all drafts in your Drafts folder. By default it returns up to 10 drafts; pass `--limit N` to fetch more. Use `nylas email drafts show DRAFT_ID` to view the full content of a single draft including the body, recipient list, and any attachments. The show command is how you verify content before delivery—a quick check that prevents a bad send.

list-inspect.sh

File: `list-inspect.sh`

```bash
# List the 20 most recent drafts
nylas email drafts list --limit 20

# Show a specific draft in full (replace the ID)
nylas email drafts show DRAFT_ID_HERE

# Extract ID, recipient, and subject from JSON output
nylas email drafts list --json | jq -r '.[] | "\(.id)  \(.to[0].email)  \(.subject)"'
```

## How do you send a draft from the terminal?

Once you’ve reviewed a draft, `nylas email drafts send DRAFT_ID` delivers it via your provider’s send API. The draft is removed from your Drafts folder and appears in Sent Items. Gmail and Outlook both handle delivery within their standard rate limits—Gmail supports up to 2,000 sends per day for Google Workspace accounts, per [Google’s sending limits documentation](https://support.google.com/a/answer/166852).

The full lifecycle (create, list, show, send) runs in seconds for a single draft. For bulk workflows you’d loop over a list of draft IDs, which the batch section below covers.

send-draft.sh

File: `send-draft.sh`

```bash
# Send a draft by ID
nylas email drafts send DRAFT_ID_HERE

# Confirm it's gone from drafts after sending
nylas email drafts list --json | jq 'length'
```

## How do you create and review drafts in bulk?

A batch draft workflow uses a shell loop to generate multiple drafts from a list of recipients, then iterates over the results for interactive review. Processing time depends on network latency and provider rate limits. The review loop below shows a one-line preview per draft and prompts you to send, skip, or view the full body before deciding.

This pattern is intentionally manual. For automated draft generation from templates with conditional content blocks, see [Automate Email Draft Creation and Review](https://cli.nylas.com/guides/auto-create-email-drafts) —that guide covers Python-based batch creation with deal-stage logic and a review manifest file.

batch-draft-review.sh

File: `batch-draft-review.sh`

```bash
#!/bin/bash
# batch-draft-review.sh — create drafts from CSV, review interactively

DRAFT_IDS=()

# Create a draft for each recipient in the CSV
while IFS=, read -r email name subject body; do
  [[ "$email" == "email" ]] && continue   # skip header row
  ID=$(nylas email drafts create \
    --to "$email" \
    --subject "$subject" \
    --body "$body" \
    --json | jq -r '.id')
  DRAFT_IDS+=("$ID")
  echo "Draft created for $name ($email) — ID: $ID"
done < contacts.csv

echo ""
echo "--- Review drafts below ---"
echo ""

# Interactive review loop
for ID in "${DRAFT_IDS[@]}"; do
  echo "Draft: $ID"
  nylas email drafts show "$ID" --json | jq -r '"To: \(.to[0].email)\nSubject: \(.subject)\nPreview: \(.body[:120])"'
  echo ""
  read -rp "Action [s]end / [n]ext: " action
  [[ "$action" == "s" ]] && nylas email drafts send "$ID" && echo "Sent."
done
```

## When should you skip drafts and send directly?

Direct send with `nylas email send` is the right choice when the content is deterministic—server alerts, cron job reports, CI build notifications, or any automated message where the output has already been validated by code. Draft workflows add 1-2 extra commands per message and a human review step, so they carry overhead that doesn’t make sense for high-confidence automated sends.

The rule of thumb: if a human reads the output before it’s sent, use drafts. If the pipeline guarantees correctness, send directly. For outbound personalization at scale with merge fields and conditional logic, drafts are the safer default because 1 error in 50 messages is 50 emails that look wrong.

## Next steps

The draft workflow is the foundation for safer outbound email from the terminal. Once you’re comfortable with the create-inspect-send cycle, you can extend it with templates, personalization, and AI-assisted composition.

- [Automate Email Draft Creation and Review](https://cli.nylas.com/guides/auto-create-email-drafts) — Python-based batch drafts with conditional content blocks, deal-stage logic, and a review manifest
- [Send Email from Linux Command Line](https://cli.nylas.com/guides/send-email-from-terminal) — direct send without SMTP, Postfix, or sendmail across Gmail, Outlook, and IMAP
- [Email Templates from the CLI](https://cli.nylas.com/guides/email-templates-cli) — define reusable subject and body templates with variable substitution
- [Personalize Outbound Email](https://cli.nylas.com/guides/personalize-outbound-email-cli) — merge contact data into messages at send time with scheduling and throttling
- [Command reference](https://cli.nylas.com/docs/commands) — every flag, subcommand, and example for all 72+ CLI commands
