npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@laffy1309/emailcli

v0.1.2

Published

A fast, interactive command-line email client for automation and AI agent workflows.

Downloads

1,042

Readme

emailcli

A fast, interactive command-line email client for automation and AI agent workflows.

npm: @laffy1309/emailcli

Quick Start

# Run directly with npx
npx @laffy1309/emailcli account add --provider gmail

# Or install globally
npm install -g @laffy1309/emailcli

Setup

1. Configure OAuth Credentials

Detailed setup guides:

Quick Summary:

Option A: Environment Variables (Recommended)

Set these before running:

export GMAIL_CLIENT_ID="your-gmail-client-id"
export GMAIL_CLIENT_SECRET="your-gmail-client-secret"
export OUTLOOK_CLIENT_ID="your-outlook-client-id"
export OUTLOOK_CLIENT_SECRET="your-outlook-client-secret"

Option B: Config File

Create ~/.emailcli/config.json:

{
  "gmail": {
    "clientId": "your-gmail-client-id",
    "clientSecret": "your-gmail-client-secret"
  },
  "outlook": {
    "clientId": "your-outlook-client-id",
    "clientSecret": "your-outlook-client-secret"
  }
}

Environment variables take precedence over config file values.

2. Add Account

# Gmail
emailcli account add --provider gmail

# Outlook
emailcli account add --provider outlook

This opens an OAuth browser flow (Gmail) or device code flow (Outlook). Complete authentication in your browser.

Commands

List Emails

# List inbox (default 20 emails)
emailcli list

# List specific folder
emailcli list --folder "[Gmail]/Sent"

# Limit results
emailcli list --limit 50

# Use specific account
emailcli list --account [email protected]:gmail

Read Email

# Read single email
emailcli read <message-id>

# Read full thread
emailcli read <thread-id> --thread

Search

# Gmail syntax
emailcli search "from:foo subject:bar"

# Outlook KQL syntax
emailcli search "from:foo subject:bar"

Send Email

# Basic send
emailcli send --to [email protected] --subject "Hello" --body "Message"

# From file
emailcli send --to [email protected] --subject "Hello" --body-file-path message.txt

# With attachments
emailcli send --to [email protected] --subject "Hello" --body "Message" --attach file.pdf

# CC/BCC
emailcli send --to [email protected] --cc [email protected] --bcc [email protected] --subject "Hello" --body "Message"

Reply

emailcli reply <message-id> --to [email protected]

Mark as Read/Unread

# Single email
emailcli mark <message-id> --read
emailcli mark <message-id> --unread

# Batch operation (D-01)
emailcli mark --ids 1,2,3 --read

Move Email

# Single
emailcli move <message-id> --folder "[Gmail]/Trash"

# Batch (D-01)
emailcli move --ids 1,2,3 --folder "[Gmail]/Trash"

Delete Email

# Single (moves to trash)
emailcli delete <message-id>

# Batch (D-01)
emailcli delete --ids 1,2,3

Folder Operations

# List folders
emailcli folders

# Mailbox status
emailcli status

Account Management

# List connected accounts
emailcli account list

# Remove account
emailcli account remove --account [email protected]:gmail

JSON Output

All commands output JSON for scripting and AI agent consumption:

{"ok": true}
{"id": "abc123", "from": "[email protected]", "subject": "Hello", "date": "2024-01-01T00:00:00Z"}
[{"id": "1", "from": "[email protected]"}, {"id": "2", "from": "[email protected]"}]

Error Format

Errors follow consistent envelope:

{"error": {"code": "NO_ACCOUNTS", "message": "No accounts configured. Run 'emailcli account add --provider gmail' first."}}

Batch Partial Failure (D-02)

When batch operations have partial failures:

{"ok": true, "failed": [{"id": "2", "error": {"code": "NOT_FOUND", "message": "Email not found"}}]}

Account Format

Accounts are stored with provider suffix: email:provider

Use --account flag to specify which account to use when multiple are configured.

Installation

# npm global install
npm install -g @laffy1309/emailcli

# Development from source
bun install
bun run build

Development

See CONTRIBUTING.md for:

  • Local development setup
  • Code style and linting
  • Running tests
  • Making changes

Requirements

  • Bun runtime (recommended)
  • Node.js 18+ (if not using Bun)

License

MIT