DEV Community

Qasim Muhammad
Qasim Muhammad

Posted on

List recent emails with optional filters from the Command Line

Scripts, cron jobs, and AI agents all need email access. nylas email list provides it without SMTP configuration.

The nylas email list command fetches recent emails from your connected mailbox and displays them in your terminal. Filter by unread, starred, sender, or attachment status.

Syntax

nylas email list [grant-id] [--unread] [--limit N]
Enter fullscreen mode Exit fullscreen mode

Examples

List recent emails:

nylas email list --limit 10
Enter fullscreen mode Exit fullscreen mode

Unread only:

nylas email list --unread
Enter fullscreen mode Exit fullscreen mode

JSON for scripting:

nylas email list --json --limit 20
Enter fullscreen mode Exit fullscreen mode

When to Use This

Reach for nylas email list when you need to process email in shell scripts, cron jobs, CI/CD pipelines, or AI agent tool calls. Combine with --json to pipe output into other tools.

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.

Related Commands


Full docs: nylas email list 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)