@push.rocks/smartmta 5.1.1 โ 5.1.3
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/changelog.md +13 -0
- package/package.json +1 -1
- package/readme.md +68 -25
package/changelog.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2026-02-11 - 5.1.3 - fix(docs)
|
|
4
|
+
clarify sendEmail default behavior and document automatic MX discovery and delivery modes
|
|
5
|
+
|
|
6
|
+
- Updated README to describe automatic MX record discovery and grouping behavior when using sendEmail() (MTA mode)
|
|
7
|
+
- Added a Delivery Modes section and API signature for sendEmail(mode) describing mta, forward, and process options
|
|
8
|
+
- Expanded examples to show multi-recipient delivery, explicit mode usage, and retained low-level sendOutboundEmail example
|
|
9
|
+
|
|
10
|
+
## 2026-02-11 - 5.1.2 - fix(readme)
|
|
11
|
+
adjust ASCII architecture diagram alignment in README
|
|
12
|
+
|
|
13
|
+
- Whitespace and alignment tweaks to the ASCII architecture diagram in readme.md
|
|
14
|
+
- No code or behavior changes; documentation-only edit
|
|
15
|
+
|
|
3
16
|
## 2026-02-11 - 5.1.1 - fix(release)
|
|
4
17
|
no changes
|
|
5
18
|
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @push.rocks/smartmta
|
|
2
2
|
|
|
3
|
-
A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with a Rust-powered SMTP engine โ no nodemailer, no shortcuts. ๐
|
|
3
|
+
A high-performance, enterprise-grade Mail Transfer Agent (MTA) built from scratch in TypeScript with a Rust-powered SMTP engine โ no nodemailer, no shortcuts. Automatic MX record discovery means you just call `sendEmail()` and smartmta figures out where to deliver. ๐
|
|
4
4
|
|
|
5
5
|
## Issue Reporting and Security
|
|
6
6
|
|
|
@@ -43,28 +43,28 @@ After installation, run `pnpm build` to compile the Rust binary (`mailer-bin`).
|
|
|
43
43
|
|
|
44
44
|
```
|
|
45
45
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
46
|
-
โ UnifiedEmailServer
|
|
47
|
-
โ (orchestrates all components, emits events)
|
|
46
|
+
โ UnifiedEmailServer โ
|
|
47
|
+
โ (orchestrates all components, emits events) โ
|
|
48
48
|
โโโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
49
49
|
โ Email โ Security โ Delivery โ Configuration โ
|
|
50
50
|
โ Router โ Stack โ System โ โ
|
|
51
|
-
โ โโโโโโโโ โ โโโโโโโโโ โ โโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโ
|
|
52
|
-
โ โMatch โ โ โ DKIM โ โ โ Queue โ โ โ DomainRegistry โ
|
|
53
|
-
โ โRoute โ โ โ SPF โ โ โ Rate Lim โ โ โ DnsManager โ
|
|
54
|
-
โ โ Act โ โ โ DMARC โ โ โ Retry โ โ โ DKIMCreator โ
|
|
55
|
-
โ โโโโโโโโ โ โ IPRep โ โ โโโโโโโโโโโโ โ โ Templates โ
|
|
56
|
-
โ โ โ Scan โ โ โ โโโโโโโโโโโโโโโโโโ
|
|
51
|
+
โ โโโโโโโโ โ โโโโโโโโโ โ โโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโ โ
|
|
52
|
+
โ โMatch โ โ โ DKIM โ โ โ Queue โ โ โ DomainRegistry โ โ
|
|
53
|
+
โ โRoute โ โ โ SPF โ โ โ Rate Lim โ โ โ DnsManager โ โ
|
|
54
|
+
โ โ Act โ โ โ DMARC โ โ โ Retry โ โ โ DKIMCreator โ โ
|
|
55
|
+
โ โโโโโโโโ โ โ IPRep โ โ โโโโโโโโโโโโ โ โ Templates โ โ
|
|
56
|
+
โ โ โ Scan โ โ โ โโโโโโโโโโโโโโโโโโ โ
|
|
57
57
|
โ โ โโโโโโโโโ โ โ โ
|
|
58
58
|
โโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
59
|
-
โ Rust Security Bridge (smartrust IPC)
|
|
59
|
+
โ Rust Security Bridge (smartrust IPC) โ
|
|
60
60
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
|
|
61
|
-
โ Rust Acceleration Layer
|
|
62
|
-
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
|
|
63
|
-
โ โ mailer-smtp โ โmailer-securityโ โ mailer-core โ
|
|
64
|
-
โ โ SMTP Server โ โDKIM/SPF/DMARC โ โ Types/Validation โ
|
|
65
|
-
โ โ SMTP Client โ โIP Rep/Content โ โ MIME/Bounce โ
|
|
66
|
-
โ โ TLS/AUTH โ โ Scanning โ โ Detection โ
|
|
67
|
-
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
|
|
61
|
+
โ Rust Acceleration Layer โ
|
|
62
|
+
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
|
|
63
|
+
โ โ mailer-smtp โ โmailer-securityโ โ mailer-core โ โ
|
|
64
|
+
โ โ SMTP Server โ โDKIM/SPF/DMARC โ โ Types/Validation โ โ
|
|
65
|
+
โ โ SMTP Client โ โIP Rep/Content โ โ MIME/Bounce โ โ
|
|
66
|
+
โ โ TLS/AUTH โ โ Scanning โ โ Detection โ โ
|
|
67
|
+
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
|
|
68
68
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -78,9 +78,10 @@ After installation, run `pnpm build` to compile the Rust binary (`mailer-bin`).
|
|
|
78
78
|
|
|
79
79
|
**Data flow for outbound mail:**
|
|
80
80
|
|
|
81
|
-
1. ๐ TypeScript constructs the email and
|
|
82
|
-
2.
|
|
83
|
-
3.
|
|
81
|
+
1. ๐ TypeScript constructs the email and calls `sendEmail()` (defaults to MTA mode)
|
|
82
|
+
2. ๐ MTA mode automatically resolves MX records for each recipient domain, sorts by priority, and groups recipients for efficient delivery
|
|
83
|
+
3. ๐ฆ Sends to Rust via IPC โ Rust builds the RFC 2822 message, signs with DKIM, and delivers via its SMTP client with connection pooling
|
|
84
|
+
4. ๐ฌ Result (accepted/rejected recipients, server response) returned to TypeScript
|
|
84
85
|
|
|
85
86
|
## Usage
|
|
86
87
|
|
|
@@ -169,9 +170,9 @@ await emailServer.start();
|
|
|
169
170
|
|
|
170
171
|
> ๐ **Note:** `start()` will throw if the Rust binary is not compiled. Run `pnpm build` first.
|
|
171
172
|
|
|
172
|
-
### ๐ง Sending
|
|
173
|
+
### ๐ง Sending Emails (Automatic MX Discovery)
|
|
173
174
|
|
|
174
|
-
|
|
175
|
+
The recommended way to send email is `sendEmail()`. It defaults to **MTA mode**, which automatically resolves MX records for each recipient domain via DNS โ you don't need to know the destination mail server:
|
|
175
176
|
|
|
176
177
|
```typescript
|
|
177
178
|
import { Email, UnifiedEmailServer } from '@push.rocks/smartmta';
|
|
@@ -179,8 +180,7 @@ import { Email, UnifiedEmailServer } from '@push.rocks/smartmta';
|
|
|
179
180
|
// Build an email
|
|
180
181
|
const email = new Email({
|
|
181
182
|
from: 'sender@example.com',
|
|
182
|
-
to: ['
|
|
183
|
-
cc: ['cc@example.com'],
|
|
183
|
+
to: ['alice@gmail.com', 'bob@company.org'],
|
|
184
184
|
subject: 'Hello from smartmta! ๐',
|
|
185
185
|
text: 'Plain text body',
|
|
186
186
|
html: '<h1>Hello!</h1><p>HTML body with <strong>formatting</strong></p>',
|
|
@@ -194,7 +194,50 @@ const email = new Email({
|
|
|
194
194
|
],
|
|
195
195
|
});
|
|
196
196
|
|
|
197
|
-
// Send
|
|
197
|
+
// Send โ MTA mode auto-discovers MX servers for gmail.com and company.org
|
|
198
|
+
const emailId = await emailServer.sendEmail(email);
|
|
199
|
+
|
|
200
|
+
// Optionally specify a delivery mode explicitly
|
|
201
|
+
const emailId2 = await emailServer.sendEmail(email, 'mta');
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
In MTA mode, smartmta:
|
|
205
|
+
- ๐ Resolves MX records for each recipient domain (e.g. `gmail.com`, `company.org`)
|
|
206
|
+
- ๐ Sorts MX hosts by priority (lowest = highest priority per RFC 5321)
|
|
207
|
+
- ๐ Tries each MX host in order until delivery succeeds
|
|
208
|
+
- ๐ Falls back to the domain's A record if no MX records exist
|
|
209
|
+
- ๐ฆ Groups recipients by domain for efficient batch delivery
|
|
210
|
+
- ๐ Signs outbound mail with DKIM automatically
|
|
211
|
+
|
|
212
|
+
### ๐ฎ Delivery Modes
|
|
213
|
+
|
|
214
|
+
`sendEmail()` accepts a mode parameter that controls how the email is delivered:
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
public async sendEmail(
|
|
218
|
+
email: Email,
|
|
219
|
+
mode: EmailProcessingMode = 'mta', // 'mta' | 'forward' | 'process'
|
|
220
|
+
route?: IEmailRoute,
|
|
221
|
+
options?: {
|
|
222
|
+
skipSuppressionCheck?: boolean;
|
|
223
|
+
ipAddress?: string;
|
|
224
|
+
isTransactional?: boolean;
|
|
225
|
+
}
|
|
226
|
+
): Promise<string>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
| Mode | Description |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `mta` (default) | **Auto MX discovery** โ resolves MX records via DNS, delivers directly to the recipient's mail server. No relay configuration needed. |
|
|
232
|
+
| `forward` | **Relay delivery** โ forwards the email to a configured SMTP host (e.g. an internal mail gateway or third-party relay). |
|
|
233
|
+
| `process` | **Scan + deliver** โ runs the content scanning / security pipeline first, then delivers via auto MX resolution. |
|
|
234
|
+
|
|
235
|
+
### ๐ฌ Direct SMTP Delivery (Low-Level)
|
|
236
|
+
|
|
237
|
+
For cases where you know the exact target SMTP server (e.g. relaying to a specific host), use the lower-level `sendOutboundEmail()`:
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
// Send directly to a known SMTP server (bypasses MX resolution)
|
|
198
241
|
const result = await emailServer.sendOutboundEmail('smtp.example.com', 587, email, {
|
|
199
242
|
auth: { user: 'sender@example.com', pass: 'your-password' },
|
|
200
243
|
dkimDomain: 'example.com',
|