codalware-auth
Version:
Complete authentication system with enterprise security, attack protection, team workspaces, waitlist, billing, UI components, 2FA, and account recovery - production-ready in 5 minutes. Enhanced CLI with verification, rollback, and App Router scaffolding.
22 lines (19 loc) • 649 B
text/typescript
import type { EmailProvider, MailArgs } from './types';
import nodemailer from 'nodemailer';
export function createNodemailerProvider(opts: { transport?: unknown } = {}): EmailProvider {
let transport: any = opts.transport;
return {
async sendMail(args: MailArgs) {
if (!transport) {
transport = (nodemailer as any).createTransport(process.env.SMTP_URL || opts.transport);
}
await transport.sendMail({
to: args.to,
from: process.env.EMAIL_FROM || 'no-reply@example.com',
subject: args.subject,
text: args.text,
html: args.html,
});
},
};
}