Create email service
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user