25 lines
444 B
JavaScript
25 lines
444 B
JavaScript
|
|
const nodemailer = require('nodemailer')
|
||
|
|
|
||
|
|
const transporter = nodemailer.createTransport({
|
||
|
|
host: process.env.SMTP_HOST,
|
||
|
|
port: process.env.SMTP_PORT,
|
||
|
|
secure: false,
|
||
|
|
auth: {
|
||
|
|
user: process.env.SMTP_USERNAME,
|
||
|
|
pass: process.env.SMTP_PASSWORD
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
send: (from, to, subject, text) => {
|
||
|
|
const options = {
|
||
|
|
from,
|
||
|
|
to,
|
||
|
|
subject,
|
||
|
|
text,
|
||
|
|
}
|
||
|
|
|
||
|
|
return transporter.sendMail(options)
|
||
|
|
}
|
||
|
|
}
|