summaryrefslogtreecommitdiffstats
path: root/helpers/sendMail.js
diff options
context:
space:
mode:
authorGravatar piotrruss <mail@pruss.it> 2023-08-21 23:41:26 +0200
committerGravatar piotrruss <mail@pruss.it> 2023-08-21 23:41:26 +0200
commit4bbd420ccff3b640612b451244d3d3422e3b470e (patch)
treedba51c7141ebc810f7de155fe8c3640ccb535ef2 /helpers/sendMail.js
parent9fb0815b575cfc23ced6722b1a164328bd3cff1a (diff)
downloadauth-service-master.tar.gz
auth-service-master.tar.bz2
auth-service-master.zip
user verificationHEADmaster
Diffstat (limited to 'helpers/sendMail.js')
-rw-r--r--helpers/sendMail.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/helpers/sendMail.js b/helpers/sendMail.js
new file mode 100644
index 0000000..6e3a370
--- /dev/null
+++ b/helpers/sendMail.js
@@ -0,0 +1,25 @@
+const mailer = require('nodemailer')
+
+const sendMail = ({to, subject, text, html}) => {
+ const transporter = mailer.createTransport({
+ port: 465,
+ host: process.env.MAIL_SMTP_SERVER,
+ auth: {
+ user: process.env.MAIL_ADDRESS,
+ pass: process.env.MAIL_PASSWORD
+ },
+ secure: true
+ })
+
+ const mailData = {
+ from: `"Pruss.it" <${process.env.MAIL_ADDRESS}>`,
+ to,
+ subject,
+ text,
+ html
+ }
+
+ return transporter.sendMail(mailData)
+}
+
+module.exports = sendMail