Skip to content
/ relay Public

Open-source email CLI ✉️ Get programmatic access to your emails using our protocol-native (IMAP, SMTP) library. Alternatives to Gmail API, made with ❤️ using Typer.

License

Notifications You must be signed in to change notification settings

relaycli/relay

Relay - protocol-native CLI for email management

CLIDiscordDocumentation

CI Status ruff ty Test coverage percentage

PyPi Version GitHub release (latest by date) License

Discord Twitter

Relay helps builds create apps on email workflows. See it as a crossover between an email client and Claude code ✉️

Quick Tour

Fetching your unread emails

relay messages ls --limit 10 --unread
Using account: piedpiper
                            Messages from [email protected]
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ UID   ┃ Timestamp                ┃ From                          ┃ Subject    ┃ Snippet    ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 15443 │ 2025-06-23 12:35:44 UTC  │ [email protected]        │ Server     │ The        │
│       │                          │                               │ migration  │ migration  │
│       │                          │                               │ complete   │ is done... │
│ 15467 │ 2025-06-26 12:46:09 UTC  │ [email protected]          │ RE: My     │ Actually   │
│       │                          │                               │ code is    │ Gilfoyle,  │
│       │                          │                               │ perfect    │ your cod...│
│ 15555 │ 2025-07-08 15:46:27 UTC  │ [email protected]           │ Team       │ Hi guys!   │
│       │                          │                               │ building   │ I've       │
│       │                          │                               │ retreat    │ organized..│
│ 15587 │ 2025-07-10 13:34:48 UTC  │ [email protected]             │ Q3         │ Richard,   │
│       │                          │                               │ metrics    │ we need to │
│       │                          │                               │ review     │ discuss... │
│ 15588 │ 2025-07-10 14:22:49 UTC  │ [email protected]               │ Acquisition│ Pied Piper │
│       │                          │                               │ offer      │ team, I'm  │
│       │                          │                               │            │ prepared...│
└───────┴──────────────────────────┴───────────────────────────────┴────────────┴────────────┘
Showing 5 of 5 unread messages

Reading email details

relay messages cat 15443
Using account: piedpiper

Message Details
UID: 15443
Timestamp: 2025-06-23 12:35:44 UTC
Subject: Server migration complete
From: "Bertram Gilfoyle" <[email protected]>
To: [email protected]
CC: [email protected], [email protected]
BCC: N/A

Message Body:
The migration is done. Obviously.

While you were all probably panicking about downtime (which never happened),
I successfully migrated our entire server infrastructure to the new data center.

Key accomplishments:
- Migrated 47 servers in 3.2 hours
- Implemented redundant failsafes
- Optimized database queries by 340%
- Fixed 23 security vulnerabilities

Richard, the system is now running at 99.97% efficiency. The remaining 0.03%
is due to the laws of physics, which even I cannot override.

Dinesh, I've documented everything in a way that even you might comprehend,
though I make no guarantees.

The servers are purring like a well-fed cat. You may now return to your
regularly scheduled mediocrity.

--
Bertram Gilfoyle
Senior Systems Architect
Pied Piper Inc.

No attachments

Get started 🚀

Prerequisites

30 seconds setup ⏱️ (docs)

1 - Install the CLI

pip install relaycli

2 - Connect your email account

relay accounts add

Follow the instructions to connect your email account.

3 - Play with the CLI

relay messages --help
 Usage: relay messages [OPTIONS] COMMAND [ARGS]...

 Email message commands


╭─ Options ──────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────╮
│ list | ls              List recent emails from specified account.                          │
│ open | cat             Read a single email message by UID.                                 │
│ search | find | grep   Search for messages containing the specified query.                 │
│ trash | rm             Move a message to trash.                                            │
│ spam                   Mark a message as spam.                                             │
│ mark                   Mark a message as read or unread.                                   │
╰────────────────────────────────────────────────────────────────────────────────────────────╯

Contributing

Oh hello there 👋 If you've scrolled this far, we bet it's because you like open-source. Do you feel like integrating a new email provider? Or perhaps improve our documentation? Or contributing in any other way?

You're in luck! You'll find everything you need in our contributing guide to help grow this project! And if you're interested, you can join us on Discord 🤗

Copying & distribution

Copyright (C) 2025, Relay.

This program is licensed under the Apache License 2.0. See LICENSE or go to https://www.apache.org/licenses/LICENSE-2.0 for full license details.

FOSSA Status

About

Open-source email CLI ✉️ Get programmatic access to your emails using our protocol-native (IMAP, SMTP) library. Alternatives to Gmail API, made with ❤️ using Typer.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •