From 0f0fe08e870c3751c7d368425fd98063b36b7943 Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Tue, 12 Nov 2019 13:24:58 -0500 Subject: [PATCH] Fix Travis CI #1 --- src/email-sender.js | 60 +++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/email-sender.js b/src/email-sender.js index 2faac8f0a8..1f14ad7908 100644 --- a/src/email-sender.js +++ b/src/email-sender.js @@ -1,39 +1,41 @@ -var nodemailer = require('nodemailer'); +let nodemailer = require('nodemailer'); -/************************************************************************* +/************************************************************************* * HOW TO USE * * Import this file - const sendEmail = require('./email-sender); * * send email - sendEmail.sendMessage("Put your error message in here"); * **************************************************************************/ -exports.sendMessage = async function (err) { +exports.sendMessage = async function (errorMessage) { - //Recipients list of users to send the email too - //receipiants is commas separated (emailName@hotmail.com,emailName2@hotmail.com) - var receipiants = ''; + // Recipients list of users to send the email too + // receipiants is commas separated (emailName@hotmail.com,emailName2@hotmail.com) + var receipiants = ''; - //Credientials to send an email from - var transporter = nodemailer.createTransport({ - service: 'gmail', - auth: { - user: '', // Email Name (.env variables must be used refer to issue#60) - pass: '' //Email Pass (.env variables must be used refer to issue#60) - } - }); + // Credientials to send an email from + var transporter = nodemailer.createTransport({ + service: 'gmail', + auth: { + user: '', // Email Name (.env variables must be used refer to issue#60) + pass: '' // Email Pass (.env variables must be used refer to issue#60) + }, + }); - //Email Content - const mailOptions = { - from: '', //Email Name - to: receipiants, - subject: 'Seneca Telescope had an error', //Subject Line - html: '

An Error has occurred
Error Message:' + err + '

' //Message Body - }; + // Email Content + const mailOptions = { + from: '', // Email Name + to: receipiants, + subject: 'Seneca Telescope had an error', // Subject Line + html: '

An Error has occurred
Error Message:' + errorMessage + '

', // Message Body + }; - //Send the email with the email content - transporter.sendMail(mailOptions, function (err, info) { - if (err) - console.log(err); - else - console.log(info); - }); -} \ No newline at end of file + // Send the email with the email content + transporter.sendMail(mailOptions, function (err, info) { + if (err) { + console.log(err); + } + else { + console.log(info); + } + }); +}; \ No newline at end of file