Skip to content

Commit

Permalink
Fix Travis CI Seneca-CDOT#1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Wilson committed Nov 12, 2019
1 parent f9874cb commit 0f0fe08
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions src/email-sender.js
Original file line number Diff line number Diff line change
@@ -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: '<p>An Error has occurred <br/>Error Message:' + err + '</p>' //Message Body
};
// Email Content
const mailOptions = {
from: '', // Email Name
to: receipiants,
subject: 'Seneca Telescope had an error', // Subject Line
html: '<p>An Error has occurred <br/>Error Message:' + errorMessage + '</p>', // Message Body
};

//Send the email with the email content
transporter.sendMail(mailOptions, function (err, info) {
if (err)
console.log(err);
else
console.log(info);
});
}
// Send the email with the email content
transporter.sendMail(mailOptions, function (err, info) {
if (err) {
console.log(err);
}
else {
console.log(info);
}
});
};

0 comments on commit 0f0fe08

Please sign in to comment.