File size: 703 Bytes
9a92a42 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import nodemailer, { Transporter } from 'nodemailer';
import { EMAIL_CONFIG } from '../config/env.config';
interface MailOptions {
to: string | string[];
subject: string;
text: string;
html: string;
}
const transporter: Transporter = nodemailer.createTransport({
service: EMAIL_CONFIG.service,
auth: {
user: EMAIL_CONFIG.user,
pass: EMAIL_CONFIG.pass,
},
});
const sendMail = async ({ to, subject, text, html }: MailOptions): Promise<void> => {
const mailOptions = {
from: EMAIL_CONFIG.user,
to,
subject,
text,
html,
};
// return Promise.resolve();
// render kmkb vercel tmkc
return transporter.sendMail(mailOptions);
};
export default sendMail; |