Connection and auth options.
A ready session.
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();
}
Opens an authenticated SMTP submission session.
Connects to the server (plaintext + STARTTLS by default, or implicit TLS when
tls: 'implicit'), negotiatesEHLO, optionally authenticates, and returns a reusable SmtpSession. Remember to SmtpSession.close (or useawait using) to sendQUITand release the socket.