17 lines
426 B
TypeScript
17 lines
426 B
TypeScript
import { getMailFrom, getMailTransport } from "./transport";
|
|
|
|
export async function sendEmail(
|
|
to: string,
|
|
template: { subject: string; html: string },
|
|
options: { replyTo?: string } = {},
|
|
) {
|
|
const transport = getMailTransport();
|
|
await transport.sendMail({
|
|
from: getMailFrom(),
|
|
to,
|
|
subject: template.subject,
|
|
html: template.html,
|
|
...(options.replyTo ? { replyTo: options.replyTo } : {}),
|
|
});
|
|
}
|