waitlist-mailer
Version:
Modern, modular TypeScript library for managing waitlists with pluggable storage and mail providers. Supports MongoDB, SQL databases, and custom adapters with zero required dependencies for basic usage.
61 lines (57 loc) • 1.62 kB
text/typescript
import { MailProvider, EmailContext } from '../../types.mjs';
/**
* Nodemailer-based mail provider for waitlist-mailer.
* Sends emails through SMTP servers using Nodemailer.
* Requires: nodemailer (already a core dependency)
*/
/**
* Nodemailer SMTP configuration.
*/
interface NodemailerConfig {
host: string;
port: number;
user: string;
pass: string;
secure?: boolean;
from?: string;
name?: string;
}
/**
* Nodemailer-based mail provider implementation.
* Sends confirmation emails via SMTP.
*/
declare class NodemailerProvider implements MailProvider {
private config;
private transporter;
private fromEmail;
private fromName;
/**
* Create a new NodemailerProvider instance.
* @param config - SMTP configuration
* @throws {Error} If nodemailer is not installed
*/
constructor(config: NodemailerConfig);
/**
* Verify the transporter configuration.
* @returns true if configuration is valid
*/
verify(): Promise<boolean>;
/**
* Send a confirmation email.
* @param email - Recipient email address
* @param context - Template context with variables
* @returns true if the email was sent successfully
*/
sendConfirmation(email: string, context: EmailContext): Promise<boolean>;
/**
* Build the email subject.
* Allows customization through context.
*/
private buildSubject;
/**
* Build the HTML body.
* Provides a default template if customHtml is not provided.
*/
private buildHtml;
}
export { type NodemailerConfig, NodemailerProvider };