From 490c3d88915e4c09e58af36abecc013cbf4e09b7 Mon Sep 17 00:00:00 2001 From: andreluis034 Date: Mon, 5 Mar 2018 11:00:01 +0000 Subject: [PATCH] get source email address from config file --- mailer.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mailer.js b/mailer.js index 98210fe..292772b 100644 --- a/mailer.js +++ b/mailer.js @@ -1,7 +1,7 @@ const nodemailer = require('nodemailer'); const config = require('./config.json'); -let transporter = nodemailer.createTransport({ +const transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: config.email.address, @@ -9,9 +9,15 @@ let transporter = nodemailer.createTransport({ } }); +/** + * Sends an email with the specified subject and message to an email address + * @param {String} email the destination email address + * @param {String} subject The Subject of the email + * @param {String} message The body of the email + */ function send(email, subject = 'No email subject provided', message = 'No email body provided') { let options = { - from: 'pretendonetwork@gmail.com', + from: config.email.address, to: email, subject: subject, html: message