added mailer
This commit is contained in:
24
backend/routes/mailer.js
Normal file
24
backend/routes/mailer.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
export function sendMail(message, title, recipient, host, user, pass, from) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: host,
|
||||
port: port,
|
||||
secure: 465,
|
||||
auth: {
|
||||
user: user,
|
||||
pass: pass,
|
||||
},
|
||||
});
|
||||
|
||||
async () => {
|
||||
const info = await transporter.sendMail({
|
||||
from: from,
|
||||
to: recipient,
|
||||
subject: title,
|
||||
text: message,
|
||||
});
|
||||
|
||||
console.log("Message sent: %s", info.messageId);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user