emailr-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +247 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1303 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Emailr CLI
|
|
2
|
+
|
|
3
|
+
The official command-line interface for the [Emailr](https://emailr.dev) email API. Send transactional emails, manage contacts, templates, domains, and more from your terminal.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### npm (recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g emailr-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Homebrew (macOS/Linux)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
brew install emailr-dev/tap/emailr-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Direct Download
|
|
20
|
+
|
|
21
|
+
Download the latest binary for your platform from the [releases page](https://github.com/emailr-dev/emailr/releases):
|
|
22
|
+
|
|
23
|
+
| Platform | Architecture | Download |
|
|
24
|
+
|----------|--------------|----------|
|
|
25
|
+
| macOS | Apple Silicon (M1/M2/M3) | `emailr-macos-arm64` |
|
|
26
|
+
| macOS | Intel | `emailr-macos-x64` |
|
|
27
|
+
| Linux | x64 | `emailr-linux-x64` |
|
|
28
|
+
| Linux | ARM64 | `emailr-linux-arm64` |
|
|
29
|
+
| Windows | x64 | `emailr-windows-x64.exe` |
|
|
30
|
+
|
|
31
|
+
After downloading:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# macOS/Linux
|
|
35
|
+
chmod +x emailr-*
|
|
36
|
+
sudo mv emailr-* /usr/local/bin/emailr
|
|
37
|
+
|
|
38
|
+
# Windows - move to a directory in your PATH
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Verify Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
emailr --version
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
### 1. Configure your API key
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
emailr config set api-key YOUR_API_KEY
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or set the environment variable:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
export EMAILR_API_KEY=YOUR_API_KEY
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 2. Send your first email
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
emailr send \
|
|
65
|
+
--to recipient@example.com \
|
|
66
|
+
--from you@yourdomain.com \
|
|
67
|
+
--subject "Hello from Emailr CLI" \
|
|
68
|
+
--html "<h1>Hello!</h1><p>This email was sent from the command line.</p>"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Commands
|
|
72
|
+
|
|
73
|
+
### Email Sending
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Send a simple email
|
|
77
|
+
emailr send --to user@example.com --from you@domain.com --subject "Hello" --html "<p>Hi!</p>"
|
|
78
|
+
|
|
79
|
+
# Send with a template
|
|
80
|
+
emailr send --to user@example.com --from you@domain.com --template TEMPLATE_ID --template-data '{"name": "John"}'
|
|
81
|
+
|
|
82
|
+
# Send with CC and BCC
|
|
83
|
+
emailr send --to user@example.com --from you@domain.com --subject "Hello" --html "<p>Hi!</p>" --cc cc@example.com --bcc bcc@example.com
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Contacts
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# List contacts
|
|
90
|
+
emailr contacts list
|
|
91
|
+
|
|
92
|
+
# Create a contact
|
|
93
|
+
emailr contacts create --email user@example.com --first-name John --last-name Doe
|
|
94
|
+
|
|
95
|
+
# Get a contact
|
|
96
|
+
emailr contacts get CONTACT_ID
|
|
97
|
+
|
|
98
|
+
# Update a contact
|
|
99
|
+
emailr contacts update CONTACT_ID --first-name Jane
|
|
100
|
+
|
|
101
|
+
# Delete a contact
|
|
102
|
+
emailr contacts delete CONTACT_ID
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Templates
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# List templates
|
|
109
|
+
emailr templates list
|
|
110
|
+
|
|
111
|
+
# Create a template
|
|
112
|
+
emailr templates create --name "Welcome Email" --subject "Welcome {{name}}!" --html "<h1>Welcome {{name}}!</h1>"
|
|
113
|
+
|
|
114
|
+
# Get a template
|
|
115
|
+
emailr templates get TEMPLATE_ID
|
|
116
|
+
|
|
117
|
+
# Update a template
|
|
118
|
+
emailr templates update TEMPLATE_ID --subject "Updated: Welcome {{name}}!"
|
|
119
|
+
|
|
120
|
+
# Delete a template
|
|
121
|
+
emailr templates delete TEMPLATE_ID
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Domains
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# List domains
|
|
128
|
+
emailr domains list
|
|
129
|
+
|
|
130
|
+
# Add a domain
|
|
131
|
+
emailr domains add example.com
|
|
132
|
+
|
|
133
|
+
# Get domain details
|
|
134
|
+
emailr domains get DOMAIN_ID
|
|
135
|
+
|
|
136
|
+
# Verify domain DNS
|
|
137
|
+
emailr domains verify DOMAIN_ID
|
|
138
|
+
|
|
139
|
+
# Check DNS status
|
|
140
|
+
emailr domains check-dns DOMAIN_ID
|
|
141
|
+
|
|
142
|
+
# Delete a domain
|
|
143
|
+
emailr domains delete DOMAIN_ID
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Configuration
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Set API key
|
|
150
|
+
emailr config set api-key YOUR_API_KEY
|
|
151
|
+
|
|
152
|
+
# Set custom API URL
|
|
153
|
+
emailr config set api-url https://api.emailr.dev
|
|
154
|
+
|
|
155
|
+
# View current config
|
|
156
|
+
emailr config show
|
|
157
|
+
|
|
158
|
+
# Clear config
|
|
159
|
+
emailr config clear
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Output Formats
|
|
163
|
+
|
|
164
|
+
All commands support `--format` option:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# JSON output (default for scripting)
|
|
168
|
+
emailr contacts list --format json
|
|
169
|
+
|
|
170
|
+
# Table output (default for interactive use)
|
|
171
|
+
emailr contacts list --format table
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Environment Variables
|
|
175
|
+
|
|
176
|
+
| Variable | Description |
|
|
177
|
+
|----------|-------------|
|
|
178
|
+
| `EMAILR_API_KEY` | Your Emailr API key |
|
|
179
|
+
| `EMAILR_BASE_URL` | Custom API URL (default: https://api.emailr.dev) |
|
|
180
|
+
|
|
181
|
+
## Configuration File
|
|
182
|
+
|
|
183
|
+
The CLI stores configuration in `~/.emailr/config.json`:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"apiKey": "et_live_...",
|
|
188
|
+
"baseUrl": "https://api.emailr.dev"
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Examples
|
|
193
|
+
|
|
194
|
+
### Send a welcome email to new users
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
#!/bin/bash
|
|
198
|
+
emailr send \
|
|
199
|
+
--to "$USER_EMAIL" \
|
|
200
|
+
--from "welcome@myapp.com" \
|
|
201
|
+
--template "welcome-template-id" \
|
|
202
|
+
--template-data "{\"name\": \"$USER_NAME\", \"activation_link\": \"$ACTIVATION_URL\"}"
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Bulk import contacts from CSV
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
#!/bin/bash
|
|
209
|
+
while IFS=, read -r email first_name last_name; do
|
|
210
|
+
emailr contacts create --email "$email" --first-name "$first_name" --last-name "$last_name"
|
|
211
|
+
done < contacts.csv
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Check domain verification status
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
#!/bin/bash
|
|
218
|
+
DOMAIN_ID=$(emailr domains list --format json | jq -r '.[0].id')
|
|
219
|
+
emailr domains check-dns "$DOMAIN_ID" --format json | jq '.dkim.verified'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Development
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Clone the repository
|
|
226
|
+
git clone https://github.com/emailr-dev/emailr.git
|
|
227
|
+
cd emailr
|
|
228
|
+
|
|
229
|
+
# Install dependencies
|
|
230
|
+
pnpm install
|
|
231
|
+
|
|
232
|
+
# Build the CLI
|
|
233
|
+
pnpm --filter emailr-cli build
|
|
234
|
+
|
|
235
|
+
# Run locally
|
|
236
|
+
node packages/sdks/cli/dist/index.js --help
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
242
|
+
|
|
243
|
+
## Support
|
|
244
|
+
|
|
245
|
+
- Documentation: https://docs.emailr.dev
|
|
246
|
+
- Issues: https://github.com/emailr-dev/emailr/issues
|
|
247
|
+
- Email: support@emailr.dev
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|