Source: https://cli.nylas.com/docs/commands/email-smart-compose

# nylas email smart-compose

AI-powered email composition — generate a draft from a text prompt.

Written by [Qasim Muhammad](https://cli.nylas.com/authors/qasim-muhammad) Staff SRE

Published February 13, 2026

Updated June 21, 2026

## What does nylas email smart-compose do?

The nylas email smart-compose command uses Nylas Smart Compose to generate an email draft from a natural language --prompt. Pass --message-id to generate a context-aware reply to an existing message instead of a brand-new email. Requires a Nylas Plus package subscription.

## Usage

```bash
nylas email smart-compose --prompt PROMPT [--message-id MESSAGE_ID]
```

## Flags

| Flag | Description |
| --- | --- |
| --json | Output as JSON |
| --no-color | Disable color output |
| --verbose(-v) | Enable verbose output |
| --config | Custom config file path |
| --help(-h) | Show help for the command |
| --limit | Limit results (most list commands) |
| --yes(-y) | Skip confirmations |
| --prompt | AI instruction for generating the email (required, max 1000 tokens) |
| --message-id | Message ID to reply to (optional, generates reply if provided) |

## Examples

The nylas email smart-compose command uses Nylas Smart Compose to generate an email draft from a natural language --prompt.

### Generate a new email draft

```bash
nylas email smart-compose --prompt "Draft a thank you email for the meeting"
```

### Generate a reply to a specific message

```bash
nylas email smart-compose --message-id msg_abc123 --prompt "Reply accepting the invitation"
```

### Output the generated draft as JSON

```bash
nylas email smart-compose --prompt "Write a follow-up email" --json
```

## Example output

```text
Generated draft:

Hi Alice,

Thanks for the productive meeting today. I'll send over the Q3 roadmap by Friday as discussed.

Best,
Bob
```

## Troubleshooting

### Generated content is off-topic or generic

Pass --message-id to give the AI the original message as context. More specific prompts produce better results.

### Command not available or returns a subscription error

Smart Compose requires a Nylas Plus package subscription. Confirm your application's plan in the Nylas dashboard.

## Related commands

[nylas email ai analyzeAnalyze recent emails with AI for a summary, categorization, and action items.](https://cli.nylas.com/docs/commands/email-ai-analyze)

[nylas email attachments downloadDownload an attachment](https://cli.nylas.com/docs/commands/email-attachments-download)

[nylas email attachments listList all attachments on a specific email.](https://cli.nylas.com/docs/commands/email-attachments-list)

[nylas email deleteDelete an email by message ID.](https://cli.nylas.com/docs/commands/email-delete)

[nylas email drafts createCreate a new draft email with optional attachments.](https://cli.nylas.com/docs/commands/email-drafts-create)

[nylas email drafts listList email drafts in your mailbox.](https://cli.nylas.com/docs/commands/email-drafts-list)

## Recommended guides

[List Fastmail emails from the CLIList Fastmail emails from the CLI through Nylas IMAP access, using app passwords, inbox filters, JSON output, and Fastmail-specific auth troubleshooting.](https://cli.nylas.com/guides/list-fastmail-emails)

[Why Cloud Servers Block SMTP PortsAWS, GCP, and Azure block outbound SMTP port 25 while ports 587 and 465 stay open. Confirm the block and send email over an HTTPS API instead.](https://cli.nylas.com/guides/smtp-ports-blocked-on-cloud-servers)

[Send Email From a Docker ContainerCloud providers block SMTP port 25 from containers. Send email over an HTTPS API on port 443 with one command and no mail daemon at all.](https://cli.nylas.com/guides/send-email-from-docker-container)

[MailerSend vs Nylas: Email ComparedMailerSend sends transactional email from verified domains. Nylas reads and syncs user inboxes across 6 providers. Compare features, pricing, and use cases.](https://cli.nylas.com/guides/mailersend-vs-nylas)

[Customer.io vs Nylas: Email ComparedCustomer.io sends lifecycle emails to your user base. Nylas reads and sends from real user inboxes via OAuth. Compare use cases, data access, and AI agents.](https://cli.nylas.com/guides/customerio-vs-nylas)

[Knock vs Nylas: Notifications vs Email APIKnock delivers multi-channel product notifications via workflows; Nylas provides two-way email and calendar sync. Compare scope, use cases, and agent support.](https://cli.nylas.com/guides/knock-vs-nylas)

Run `nylas email smart-compose --help` for full help output.
