Pass options to theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/puiusabin/bun-smtp/llms.txt
Use this file to discover all available pages before exploring further.
SMTPServer constructor:
Connection
Start in implicit TLS mode (port 465 style). When
false, STARTTLS is offered instead.Reject AUTH and MAIL until the client completes STARTTLS.
Server hostname included in the
220 greeting and EHLO response.Extra text appended to the
220 greeting line.Use LMTP instead of SMTP. Clients open with
LHLO and onData may return per-recipient responses.Format string for the HELO/EHLO response. First
%s is the server name, second is the client hostname.Authentication
SASL methods advertised in EHLO. Supported values:
"PLAIN", "LOGIN", "CRAM-MD5", "XOAUTH2".Allow clients to skip AUTH entirely.
Allow AUTH over a plain (non-TLS) connection.
Custom error message for the
530 response when auth is required.By default, AUTH is disabled over non-TLS connections. Set
allowInsecureAuth: true to permit plaintext authentication.Capability Flags
These options hide extensions from the EHLO response. The extension still works — it is just not advertised.Hide
STARTTLS from EHLO.Hide the
SIZE extension.Hide
PIPELINING.Hide
DSN (Delivery Status Notification).Hide
ENHANCEDSTATUSCODES.Hide
REQUIRETLS.Hide
8BITMIME.Hide
SMTPUTF8.Block specific SMTP commands entirely (e.g.
["AUTH", "STARTTLS"]).Limits
Maximum message size in bytes. Advertised via the
SIZE extension. The onData stream’s sizeExceeded flag is set when the limit is hit.Maximum number of simultaneous connections. New connections are rejected with
421 when the limit is reached.Milliseconds of inactivity before an idle connection is closed.
Milliseconds to wait for connections to drain during
server.close(). Connections still open after this are forcibly terminated.Maximum commands allowed before authentication. Set to
false to disable the limit.Proxy / X-headers
Trust Postfix
XCLIENT headers. When enabled, session.xClient is populated.Trust Postfix
XFORWARD headers. When enabled, session.xForward is populated.Parse HAProxy
PROXY protocol header. Pass an array of trusted proxy IP addresses to restrict which proxies are trusted.Only enable proxy headers if you trust the upstream proxy. Malicious clients can forge these headers.
DNS
Skip reverse DNS lookup on new connections. When
false, session.clientHostname is resolved from the client’s IP.Custom DNS resolver. Must implement
reverse(ip, callback) with the same signature as dns.reverse.TLS
All standard TLS options. See the TLS & STARTTLS guide for usage examples.Private key in PEM format.
Certificate in PEM format.
CA bundle for client certificate verification.
Request a client certificate during TLS handshake.
Reject clients with invalid or unverifiable certificates.
Minimum TLS version string (e.g.
"TLSv1.2").Maximum TLS version string.
Per-hostname TLS configuration for SNI (Server Name Indication).
If no TLS options are provided, the server uses a default self-signed certificate for development.
Callbacks
All lifecycle callbacks can be set as constructor options. See Callbacks for full signatures and examples.Called on new connection.
Called after TLS handshake.
Called on AUTH attempt.
Called on MAIL FROM.
Called on RCPT TO.
Called when DATA transfer begins.
Called when connection closes.