Developer reference

Use the Emayler CLI

Install the CLI, sign in and work with your mailboxes from a terminal. Sending stays in the Emayler inbox.

Before you start

Use Node.js 22 or later and an Emayler account. The CLI is published on npm as @emayler/cli. Interactive commands sign in through your browser; unattended scripts can use an API key instead.

Install

Install the CLI
npm install -g @emayler/cli
emayler --help

You can also install the tarball from the GitHub release.

Add --help to a command group or command to see its arguments, for example emayler mail --help or emayler mail search --help.

Sign in and out

emayler login
emayler whoami

Approve the connection in your browser. The CLI saves the sign-in on that machine and refreshes it as needed. To open the browser yourself, run emayler login --no-browser and open the printed URL on the same machine as the CLI.

Run emayler logout to clear the saved sign-in from the machine. Logging out does not revoke the grant. To revoke it, open Settings in Emayler and remove the CLI under Connected apps.

Set up a hosted address

Every plan includes addresses on emayler.email, so you can receive mail without changing DNS. Claim a name, then create a mailbox on it:

emayler domain claim my-studio
emayler mailbox create hello@my-studio.emayler.email --name "Hello"

The address looks like hello@my-studio.emayler.email. Hosted addresses require availability on your account. Incoming mail is delivered to the new address. Sending is approved separately and happens in the web inbox.

Connect a domain you own

Add the domain and read the records you need to publish:

emayler domain add example.com
emayler domain dns dom_yourid

Publish the records at your DNS provider, then recheck the domain:

emayler domain check dom_yourid

If your provider supports Domain Connect, you can check availability and open the approval URL instead of copying records:

emayler domain connect-status dom_yourid
emayler domain connect dom_yourid

After the domain is verified, create a mailbox on it:

emayler mailbox create hello@example.com --name "Hello"

Direct DNS writeback is not available

The registrar, domain dns-preview and domain dns-apply commands require a server with registrar token storage and direct DNS writeback. Hosted Emayler does not provide that, so these commands return an error and do not change your DNS. Use the records from emayler domain dns or Domain Connect.

List mailboxes and read mail

List the mailboxes you can access to get their IDs:

emayler mailbox list
emayler mail list mbx_yourid --limit 10

mail list shows recent conversations and their thread IDs. Pass a mailbox ID to limit it to one mailbox. Receiving is automatic once the address exists and, for a domain you own, its DNS checks pass.

Open a thread with message previews, then read one message in full:

emayler mail read thr_yourid --message msg_yourid
emayler mail body msg_yourid

Search mail

emayler mail search "invoice" --mailbox mbx_yourid
emayler mail search --mailbox mbx_yourid --from client@example.com --after 2026-01-01

The query matches message text. Narrow results with --mailbox, --from, --to, --after, --before and --has-attachment. Results include message and thread IDs. If a response includes next_cursor, pass it with --cursor to fetch the next page.

Save a draft

emayler draft save --mailbox mbx_yourid --to client@example.com \
  --subject "Invoice received" --body-file ./reply.txt

Use --body for short text, or --body-file - to read from standard input. Add --cc, --bcc or --reply-to when needed. The draft is saved to your web inbox for review.

Send from Emayler after your account is approved and the domain is verified. See Send email. Use emayler draft list to list drafts and emayler draft delete drf_yourid --confirm to remove one.

Scripts and permissions

  • Commands write JSON to standard output. API errors go to standard error with a nonzero exit status, so scripts can check the exit code.
  • For unattended work, create an API key in API Keys and set EMAYLER_API_KEY. A read key can list resources and search mail. A write key can also create or change resources. Where a command accepts a key, it takes priority over a saved browser sign-in.
  • Commands that change data accept --idempotency-key where supported. Reuse the original key when retrying the same action after a timeout.
  • Commands that remove data require an explicit confirmation, such as --confirm example.com for a domain.
  • Structured input uses --data <file> or --data -. Downloads use --output <new-file> or --output -.
  • Set EMAYLER_API_URL to use a development API. The default is https://api.emayler.com.

API keys cannot send email. Draft and personal account commands use the browser sign-in; set EMAYLER_ACCESS_TOKEN to supply a first-party user token from an integration. Sign-in credential changes, passkeys and account deletion stay in the web app.

If a command fails

Read the error on standard error. Check that you are signed in with emayler whoami, that the resource ID is correct, and that an API key has the permission the command needs. Domain changes still depend on DNS checks passing. For general problems, see Troubleshooting.