fix(mail): align queue, outbound hostname, and DKIM selector behavior across the mail server APIs
This commit is contained in:
17
readme.md
17
readme.md
@@ -95,6 +95,8 @@ import { UnifiedEmailServer } from '@push.rocks/smartmta';
|
||||
const emailServer = new UnifiedEmailServer(dcRouterRef, {
|
||||
// Ports to listen on (465 = implicit TLS, 25/587 = STARTTLS)
|
||||
ports: [25, 587, 465],
|
||||
|
||||
// Public SMTP hostname used for greeting/banner and as the default outbound identity
|
||||
hostname: 'mail.example.com',
|
||||
|
||||
// Multi-domain configuration
|
||||
@@ -160,6 +162,16 @@ const emailServer = new UnifiedEmailServer(dcRouterRef, {
|
||||
keyPath: '/etc/ssl/mail.key',
|
||||
},
|
||||
|
||||
outbound: {
|
||||
// Optional override for outbound EHLO/HELO identity
|
||||
hostname: 'smtp-out.example.com',
|
||||
},
|
||||
|
||||
queue: {
|
||||
storageType: 'disk',
|
||||
persistentPath: '/var/lib/smartmta/email-queue',
|
||||
},
|
||||
|
||||
maxMessageSize: 25 * 1024 * 1024, // 25 MB
|
||||
maxClients: 500,
|
||||
});
|
||||
@@ -169,6 +181,8 @@ await emailServer.start();
|
||||
```
|
||||
|
||||
> 🔒 **Note:** `start()` will throw if the Rust binary is not compiled. Run `pnpm build` first.
|
||||
>
|
||||
> `hostname` is the public SMTP identity for greetings and outbound delivery by default. It is not a bind address.
|
||||
|
||||
### 📧 Sending Emails (Automatic MX Discovery)
|
||||
|
||||
@@ -201,6 +215,8 @@ const emailId = await emailServer.sendEmail(email);
|
||||
const emailId2 = await emailServer.sendEmail(email, 'mta');
|
||||
```
|
||||
|
||||
`sendEmail()` returns the delivery queue item ID, which you can later use with queue/status APIs.
|
||||
|
||||
In MTA mode, smartmta:
|
||||
- 🔍 Resolves MX records for each recipient domain (e.g. `gmail.com`, `company.org`)
|
||||
- 📊 Sorts MX hosts by priority (lowest = highest priority per RFC 5321)
|
||||
@@ -254,6 +270,7 @@ The `sendOutboundEmail` method:
|
||||
- 🔑 Automatically resolves DKIM keys from the `DKIMCreator` for the specified domain
|
||||
- 🔗 Uses connection pooling in Rust — reuses TCP/TLS connections across sends
|
||||
- ⏱️ Configurable connection and socket timeouts via `outbound` options on the server
|
||||
- 🪪 Uses `outbound.hostname` as the SMTP identity when configured, otherwise falls back to `hostname`
|
||||
|
||||
### 🔑 DKIM Signing & Key Management
|
||||
|
||||
|
||||
Reference in New Issue
Block a user