otp : gwm
This commit is contained in:
parent
dffdc00142
commit
3972907947
@ -1,18 +1,24 @@
|
||||
const nodemailer = require("nodemailer");
|
||||
|
||||
exports.sendEmail = async (to, subject, body) => {
|
||||
|
||||
const port = Number(process.env.MAIL_PORT);
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: process.env.MAIL_HOST,
|
||||
port: process.env.MAIL_PORT,
|
||||
secure: false,
|
||||
|
||||
host: process.env.MAIL_HOST,
|
||||
port,
|
||||
secure: port === 465, // SSL
|
||||
requireTLS: port === 587, // Enforce TLS for 587
|
||||
auth: {
|
||||
user: process.env.MAIL_USER,
|
||||
pass: process.env.MAIL_PASS,
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
await transporter.sendMail({
|
||||
from: process.env.MAIL_FROM || "noreply@example.com",
|
||||
from: process.env.SMTP_FROM || process.env.SMTP_USER,
|
||||
to,
|
||||
subject,
|
||||
html: body,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user