Every callback receives aDocumentation 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.
session object representing the current connection state.
SMTPSession
The main session object passed to all callbacks.Unique connection identifier.
true if the connection is currently using TLS.SNI hostname from the TLS handshake (if TLS is active).
Server IP address.
Server port.
Client IP address.
Client port.
Reverse-DNS hostname of the client. Falls back to
"[remoteAddress]" if lookup fails or is disabled.Hostname the client claimed in HELO/EHLO.
The first command the client sent:
"HELO", "EHLO", or "LHLO".SMTP transmission type string, e.g.
"ESMTPSA" (Extended SMTP with Auth).TLS cipher info after TLS is established,
false before. See TLSCipherInfo below.Value passed as
user in a successful onAuth response. Use this to track the authenticated user.Number of completed mail transactions on this connection (incremented after each successful
onData).Current mail envelope. See SMTPEnvelope below.
XCLIENT header values (when
useXClient: true).XFORWARD header values (when
useXForward: true).TLSCipherInfo
TLS cipher and protocol information, available after TLS handshake.OpenSSL cipher name (e.g.
"ECDHE-RSA-AES128-GCM-SHA256").IANA cipher name.
TLS protocol version (e.g.
"TLSv1.3").Example
SMTPEnvelope
Available assession.envelope. Populated progressively as the client sends MAIL FROM and RCPT TO commands.
Sender address from MAIL FROM, or
false before MAIL FROM is received.Array of accepted recipient addresses from RCPT TO.
Body encoding declared by the client.
true if the client declared SMTPUTF8 support.true if the client sent REQUIRETLS (RFC 8689).DSN envelope parameters. See DSNEnvelope below.
Example
SMTPAddress
Represents an email address from MAIL FROM or RCPT TO commands.The email address (e.g.
"alice@example.com").ESMTP parameters from the command, or
false if none. See SMTPAddressArgs below.SMTPAddressArgs
ESMTP parameters parsed from the MAIL FROM or RCPT TO command.Declared message size in bytes.
Body type:
"7BIT" or "8BITMIME".UTF-8 support flag.
TLS-required flag (RFC 8689).
DSN return type (
"FULL" or "HDRS").DSN envelope ID.
DSN notification conditions (comma-separated, e.g.
"SUCCESS,FAILURE").DSN original recipient address.
Any unrecognized ESMTP parameter is also available as a string or
true.Example
DSNEnvelope
DSN (Delivery Status Notification) parameters from the envelope.Return type requested by the client:
"FULL": Return full message in DSN"HDRS": Return headers onlynull: No preference specified
Envelope identifier for tracking DSN reports.
DSNRcpt
Per-recipient DSN parameters.DSN notification conditions (e.g.
["SUCCESS", "FAILURE", "DELAY"]).Original recipient address (for forwarding scenarios).
Example
DataStream
AReadableStream<Uint8Array> with extra metadata set after the stream closes.
Total bytes received (available after stream closes).
true if the message exceeded the configured size limit.