edgeport - v1.0.3
    Preparing search index...

    Interface SmtpSession

    A live, authenticated SMTP session that can send one or more messages.

    Obtain one with connect. It is an AsyncDisposable, so it can be scoped with await using and will QUIT on disposal.

    1.0.0

    import { connect } from 'edgeport/smtp';

    await using session = await connect({
    hostname: 'smtp.example.com',
    auth: { username: 'me@example.com', password: process.env.SMTP_PASS! }
    });
    await session.send({ from: 'me@example.com', to: 'you@example.com', subject: 'Hi', text: 'Yo' });
    interface SmtpSession {
        "[asyncDispose]"(): PromiseLike<void>;
        close(): Promise<void>;
        send(mail: Mail): Promise<SendResult>;
    }

    Hierarchy

    • AsyncDisposable
      • SmtpSession
    Index
    • Returns PromiseLike<void>

    • Sends QUIT and closes the underlying socket.

      Returns Promise<void>

    • Sends one message over the open session.

      Parameters

      • mail: Mail

        The message to send.

      Returns Promise<SendResult>

      The accepted recipients and the server's final reply.

      If the server rejects any envelope or data command.