Scripts, cron jobs, and AI agents all need email access. nylas email delete provides it without SMTP configuration.
The nylas email delete command permanently removes a message from the provider. On Gmail this moves to Trash; on IMAP it sets the \Deleted flag.
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.
Syntax
nylas email delete --id MESSAGE_ID [--force]
Examples
Delete a specific email:
nylas email delete --id msg_abc123
Batch delete old emails with jq pipe:
nylas email list --json --limit 50 | jq -r '.[].id' | xargs -I{} nylas email delete --id {} --force
Key Flags
Run nylas email delete --help to see all available flags. Add --json for machine-readable output — useful when piping into jq or feeding data to scripts.
nylas email delete --help
Full docs: nylas email delete 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)