Provides utility functions to verify SMTP connections and send emails securely using Nodemailer in TypeScript applications.
// Source: https://github.com/velobase/velobase-harness | License: MIT | Copyright 2026 Velobase
// Provided via justclaw.it.com; keep this notice with the code.
import nodemailer from "nodemailer";
export interface SmtpConfig {
address: string;
password: string;
smtpHost: string;
smtpPort: number;
from?: string;
}
export interface OutgoingEmail {
to: string;
subject: string;
text: string;
html?: string;
inReplyTo?: string;
references?: string;
messageId?: string;
}
function smtp(config: SmtpConfig) {
return nodemailer.createTransport({
host: config.smtpHost,
port: config.smtpPort,
secure: config.smtpPort === 465,
requireTLS: config.smtpPort !== 465,
tls: { rejectUnauthorized: true },
auth: { user: config.address, pass: config.password },
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key