Scripts, cron jobs, and AI agents all need email access. nylas email smart-compose provides it without SMTP configuration.
The nylas email smart-compose command generates email content from a natural language prompt. Optionally pass --thread-id to give the AI context from an existing conversation so the reply matches tone and content.
Syntax
nylas email smart-compose --prompt PROMPT [--to EMAIL] [--thread-id THREAD_ID]
Examples
Compose from a prompt:
nylas email smart-compose --prompt "Decline the meeting politely, suggest next week instead" --to colleague@company.com
Reply in thread context:
nylas email smart-compose --prompt "Accept the proposal and ask about timeline" --thread-id thread_abc123
Generate and send in one pipeline:
nylas email smart-compose --prompt "Thank them for the intro" --to partner@startup.com --json | nylas email send --from-draft --yes
How It Works
The Nylas CLI abstracts away the differences between Gmail's API, Microsoft Graph, Exchange Web Services, and raw IMAP. You write one command; it works across all providers. This matters for automation — your cron job or CI pipeline doesn't need provider-specific logic.
Key Flags
Run nylas email smart-compose --help to see all available flags. Add --json for machine-readable output — useful when piping into jq or feeding data to scripts.
nylas email smart-compose --help
Common Issues
Generated content is off-topic or generic
Pass --thread-id to give the AI conversation context. More specific prompts produce better results.
Command not found or not available
AI features require Nylas CLI v1.4+. Run nylas --version to check, then update with brew upgrade nylas-cli or re-run the install script.
Related Commands
-
nylas email send— Send an email. Supports scheduling, GPG signing/encryption, and tracking -
nylas email list— List recent emails with optional filters -
nylas email read— Read a specific email. Supports decryption and signature verification -
nylas email search— Search emails by query and filters
Full docs: nylas email smart-compose reference — all flags, advanced examples, and troubleshooting.
All commands: Nylas CLI Command Reference
Get started: brew install nylas/nylas-cli/nylas — other install methods
Top comments (0)