Guide

List Your Yahoo Mail Emails from the Command Line

Yahoo Mail's IMAP access requires generating app-specific passwords, configuring IMAP settings manually, and dealing with Yahoo's security blocks. The Nylas CLI handles OAuth2 and provider abstraction behind the scenes — authenticate once, then list, search, and read emails with a single command.

The problem with Yahoo Mail access

To access Yahoo Mail programmatically, you need to generate an app-specific password, enable IMAP in Yahoo settings, and configure a mail client with Yahoo's IMAP server settings. Yahoo frequently blocks third-party access attempts, and there is no official CLI or REST API for consumer Yahoo Mail accounts.

Tools like fetchmail or mutt can connect via IMAP, but they require manual credential management and do not offer a clean way to search or filter from the command line.

1. Install the Nylas CLI

# macOS / Linux (Homebrew)
brew install nylas/nylas-cli/nylas

# Or build from source (requires Go 1.23+)
go install github.com/nylas/cli/cmd/nylas@latest

2. Connect your Yahoo Mail account

Head to dashboard-v3.nylas.com, create an application, and connect your Yahoo Mail account. Then grab your API key:

nylas auth config
# Paste your API key when prompted

# Verify the connection
nylas auth whoami
# => Authenticated as you@yahoo.com (Yahoo)

3. List your emails

# List recent emails
nylas email list

# Limit results
nylas email list --limit 10

# Only unread emails
nylas email list --unread
# Search by keyword
nylas email search "receipt" --limit 5

# Search by sender
nylas email search "from:notifications@yahoo.com"

# Search within a date range
nylas email search "after:2026-01-01 before:2026-02-01"

5. Read a specific email

# Read an email by ID (IDs are shown in list output)
nylas email read msg_abc123

# Read the raw MIME source
nylas email read msg_abc123 --mime

6. JSON output for scripting

Every command supports --json output, so you can pipe it into jq, a script, or an AI agent:

# Count unread emails
nylas email list --unread --json | jq length

# Extract subjects
nylas email list --limit 5 --json | jq '.[].subject'

A quick script to summarize your inbox:

#!/bin/bash
unread=$(nylas email list --unread --json | jq length)
echo "Unread emails: $unread"

nylas email list --unread --json \
  | jq -r '.[] | "\(.from[0].email): \(.subject)"' \
  | head -5

7. Work with Yahoo Mail folders

Yahoo Mail uses a folder-based system with some built-in folders that differ from other providers:

# List emails in a specific folder
nylas email list --folder "Inbox"
nylas email list --folder "Bulk Mail"
nylas email list --folder "Draft"

# List all available folders
nylas folder list

# Yahoo's "Bulk Mail" is their spam folder
nylas email list --folder "Bulk Mail" --limit 5

8. Yahoo security and app access

Yahoo has historically been restrictive about third-party email access. Here is how the traditional approach compares:

StepYahoo IMAP (traditional)Nylas CLI
Enable accessToggle "Allow less secure apps" or generate app passwordOAuth2 via Nylas dashboard
Server configimap.mail.yahoo.com:993, SSL requiredNot required
AuthenticationApp-specific password (breaks if Yahoo changes policy)OAuth2 (token refresh handled automatically)
Security blocksYahoo frequently blocks "suspicious" IMAP loginsNo blocks — uses official OAuth flow
Two-factor authRequires app password workaroundWorks natively with 2FA enabled
SearchIMAP SEARCH command (limited)nylas email search (full-text)

9. Yahoo Mail variants

The Nylas CLI works with all Yahoo Mail account types:

  • Yahoo Mail Free — standard consumer accounts (@yahoo.com)
  • Yahoo Mail Plus — ad-free accounts with priority support
  • AT&T Yahoo Mail@att.net accounts powered by Yahoo Mail
  • Verizon Yahoo Mail — legacy @verizon.net accounts migrated to Yahoo
  • Yahoo Small Business — custom domain email hosted on Yahoo

All variants authenticate through the same OAuth2 flow. No special configuration is needed.

Next steps