13 lines
489 B
TypeScript
13 lines
489 B
TypeScript
import nodemailer from "nodemailer";
|
|
import { getSmtpSettings } from "./integration-settings";
|
|
|
|
export async function sendMail(to: string, subject: string, text: string): Promise<void> {
|
|
const smtp = await getSmtpSettings();
|
|
const t = nodemailer.createTransport({
|
|
host: smtp.host || undefined,
|
|
port: smtp.port,
|
|
auth: smtp.user || smtp.pass ? { user: smtp.user, pass: smtp.pass } : undefined,
|
|
});
|
|
await t.sendMail({ from: smtp.from || undefined, to, subject, text });
|
|
}
|