Skip to content

SmtpCore

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:81

Commands shared by SMTP and LMTP.

The two protocols differ only in their greeting verb and in how the message body is acknowledged, so everything else lives here. LMTP deliberately does not inherit SmtpClient: DATA yields one reply per recipient in LMTP and exactly one reply in SMTP, so inheriting data() would expose a method that silently misreads the wire.

new SmtpCore(source, options?): SmtpCore

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:94

Transport

Any Transport. For a Node.js Duplex/net.Socket, wrap it first: new DuplexTransport(socket) from @ac-kit/net-transport-node.

SmtpClientOptions

Buffer, line-length and timeout tuning.

SmtpCore

Session< string, string, SmtpClientEvents >.constructor

get buffered(): number

Defined in: packages/net-core/src/session.ts:243

Bytes received but not yet decoded.

number

Session.buffered


get pendingExchanges(): number

Defined in: packages/net-core/src/session.ts:248

Number of outstanding exchanges, including abort tombstones.

number

Session.pendingExchanges

[asyncDispose](): Promise<void>

Defined in: packages/net-core/src/session.ts:277

Destroys the session, so it can be used with await using.

Promise<void>

Session.[asyncDispose]


command(command, options?): Promise<SmtpResponse>

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:208

Send a raw command line and read its reply.

string

The command line, without a terminator.

ExchangeOptions<string>

Abort, timeout and abort-policy overrides.

Promise<SmtpResponse>

The parsed reply.


destroy(error?): void

Defined in: packages/net-core/src/session.ts:271

Tear the session down, rejecting every outstanding exchange.

Rejection happens here rather than relying on the transport emitting close, so callers are never left with promises that hang against a transport that closes silently.

unknown

Optional cause reported to outstanding exchanges.

void

Session.destroy


ehlo(domain, options?): Promise<SmtpResponse>

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:112

Send EHLO domain and return the advertised extensions.

string

The client’s own domain name.

ExchangeOptions<string>

Abort, timeout and abort-policy overrides.

Promise<SmtpResponse>

The parsed reply, one entry per capability line.


end(): Promise<void>

Defined in: packages/net-core/src/session.ts:258

Half-close the outbound direction and flush pending writes.

Prefer this over destroy for protocols with a farewell command, so the peer sees an orderly shutdown.

Promise<void>

Session.end


isSubscribed<K>(event, listener): boolean

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:38

Check if a callback is subscribed to a specific event.

K extends "push" | keyof BaseSessionEvents

K

The event name.

Callable<SmtpClientEvents[K]>

The callback to check.

boolean

Session.isSubscribed


mailFrom(address, params?, options?): Promise<SmtpResponse>

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:127

Send MAIL FROM:<address>.

string

The reverse-path, without angle brackets.

string

Optional ESMTP parameters, for example SIZE=1234.

ExchangeOptions<string>

Abort, timeout and abort-policy overrides.

Promise<SmtpResponse>

The parsed reply.


quit(options?): Promise<SmtpResponse>

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:197

Send QUIT and read the farewell reply.

ExchangeOptions<string>

Abort, timeout and abort-policy overrides.

Promise<SmtpResponse>

The parsed reply, normally 221.


rcptTo(address, options?): Promise<SmtpResponse>

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:145

Send RCPT TO:<address>.

string

The forward-path, without angle brackets.

ExchangeOptions<string>

Abort, timeout and abort-policy overrides.

Promise<SmtpResponse>

The parsed reply.


subscribe<K>(event, listener, options?): Callable | null

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:23

K extends "push" | keyof BaseSessionEvents

K

Callable<SmtpClientEvents[K]>

EventDispatcherSubscribeOptions

Callable | null

Session.subscribe


unsubscribe<K>(event, listener): void

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:31

Unsubscribe a callback from a specific event.

K extends "push" | keyof BaseSessionEvents

K

The event name.

Callable<SmtpClientEvents[K]>

The callback to remove.

void

Session.unsubscribe


upgradeTransport(transport): void

Defined in: packages/net-smtp/src/smtp/smtp-client.ts:229

Replace the transport after a successful STARTTLS.

Buffered plaintext is discarded rather than carried across: bytes a peer sent before the handshake must never be read as part of the secured session, which is the STARTTLS command-injection flaw.

Transport

The TLS transport wrapping the same connection.

void


wait<K>(event, options?): Promise<SmtpClientEvents[K]>

Defined in: packages/async/src/events/event-dispatcher-map-base.ts:45

Wait for the next occurrence of a specific event, optionally matching a predicate.

This is a convenience method that subscribes to the dispatcher, waits for the next event that matches the predicate (if provided), and then unsubscribes automatically.

K extends "push" | keyof BaseSessionEvents

K

The event name to wait for.

EventDispatcherWaitOptions<SmtpClientEvents[K]>

Optional settings including predicate and abort signal.

Promise<SmtpClientEvents[K]>

A promise that resolves with the event arguments as an array.

Session.wait