Command-line interface for the Emailr email API
npm install emailr-cliThe official command-line interface for the Emailr email API. Send transactional emails, manage contacts, templates, domains, and more from your terminal.
``bash`
npm install -g emailr-cli
`bash`
brew install emailr-dev/tap/emailr-cli
Download the latest binary for your platform from the releases page:
| Platform | Architecture | Download |
|----------|--------------|----------|
| macOS | Apple Silicon (M1/M2/M3) | emailr-macos-arm64 |emailr-macos-x64
| macOS | Intel | |emailr-linux-x64
| Linux | x64 | |emailr-linux-arm64
| Linux | ARM64 | |emailr-windows-x64.exe
| Windows | x64 | |
After downloading:
`bashmacOS/Linux
chmod +x emailr-*
sudo mv emailr-* /usr/local/bin/emailr
$3
`bash
emailr --version
`Quick Start
$3
`bash
emailr config set api-key YOUR_API_KEY
`Or set the environment variable:
`bash
export EMAILR_API_KEY=YOUR_API_KEY
`$3
`bash
emailr send \
--to recipient@example.com \
--from you@yourdomain.com \
--subject "Hello from Emailr CLI" \
--html "Hello!
This email was sent from the command line.
"
`Commands
$3
`bash
Send a simple email
emailr send --to user@example.com --from you@domain.com --subject "Hello" --html "Hi!
"Send with a template
emailr send --to user@example.com --from you@domain.com --template TEMPLATE_ID --template-data '{"name": "John"}'Send with CC and BCC
emailr send --to user@example.com --from you@domain.com --subject "Hello" --html "Hi!
" --cc cc@example.com --bcc bcc@example.com
`$3
`bash
List contacts
emailr contacts listCreate a contact
emailr contacts create --email user@example.com --first-name John --last-name DoeGet a contact
emailr contacts get CONTACT_IDUpdate a contact
emailr contacts update CONTACT_ID --first-name JaneDelete a contact
emailr contacts delete CONTACT_ID
`$3
`bash
List templates
emailr templates listCreate a template
emailr templates create --name "Welcome Email" --subject "Welcome {{name}}!" --html "Welcome {{name}}!
"Get a template
emailr templates get TEMPLATE_IDUpdate a template
emailr templates update TEMPLATE_ID --subject "Updated: Welcome {{name}}!"Delete a template
emailr templates delete TEMPLATE_ID
`$3
`bash
List domains
emailr domains listAdd a domain
emailr domains add example.comGet domain details
emailr domains get DOMAIN_IDVerify domain DNS
emailr domains verify DOMAIN_IDCheck DNS status
emailr domains check-dns DOMAIN_IDDelete a domain
emailr domains delete DOMAIN_ID
`$3
`bash
Set API key
emailr config set api-key YOUR_API_KEYSet custom API URL
emailr config set api-url https://api.emailr.devView current config
emailr config showClear config
emailr config clear
`Output Formats
All commands support
--format option:`bash
JSON output (default for scripting)
emailr contacts list --format jsonTable output (default for interactive use)
emailr contacts list --format table
`Environment Variables
| Variable | Description |
|----------|-------------|
|
EMAILR_API_KEY | Your Emailr API key |
| EMAILR_BASE_URL | Custom API URL (default: https://api.emailr.dev) |Configuration File
The CLI stores configuration in
~/.emailr/config.json:`json
{
"apiKey": "et_live_...",
"baseUrl": "https://api.emailr.dev"
}
`Examples
$3
`bash
#!/bin/bash
emailr send \
--to "$USER_EMAIL" \
--from "welcome@myapp.com" \
--template "welcome-template-id" \
--template-data "{\"name\": \"$USER_NAME\", \"activation_link\": \"$ACTIVATION_URL\"}"
`$3
`bash
#!/bin/bash
while IFS=, read -r email first_name last_name; do
emailr contacts create --email "$email" --first-name "$first_name" --last-name "$last_name"
done < contacts.csv
`$3
`bash
#!/bin/bash
DOMAIN_ID=$(emailr domains list --format json | jq -r '.[0].id')
emailr domains check-dns "$DOMAIN_ID" --format json | jq '.dkim.verified'
`Development
`bash
Clone the repository
git clone https://github.com/emailr-dev/emailr.git
cd emailrInstall dependencies
pnpm installBuild the CLI
pnpm --filter emailr-cli buildRun locally
node packages/sdks/cli/dist/index.js --help
``MIT License - see LICENSE for details.
- Documentation: https://docs.emailr.dev
- Issues: https://github.com/emailr-dev/emailr/issues
- Email: support@emailr.dev