edgeport - v1.0.3
    Preparing search index...

    Function connect

    • Opens an authenticated SMTP submission session.

      Connects to the server (plaintext + STARTTLS by default, or implicit TLS when tls: 'implicit'), negotiates EHLO, optionally authenticates, and returns a reusable SmtpSession. Remember to SmtpSession.close (or use await using) to send QUIT and release the socket.

      Parameters

      Returns Promise<SmtpSession>

      A ready session.

      If the socket cannot be opened.

      If the server speaks SMTP incorrectly.

      If authentication fails.

      1.0.0

      import { connect } from 'edgeport/smtp';

      const session = await connect({
      hostname: 'smtp.example.com',
      port: 587,
      auth: { username: 'me@example.com', password: 'app-password' }
      });
      try {
      const { accepted } = await session.send({
      from: 'me@example.com',
      to: ['a@example.com', 'b@example.com'],
      subject: 'Report',
      html: '<p>done</p>'
      });
      console.log('accepted', accepted);
      } finally {
      await session.close();
      }