You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
crontab-ui/bin/crontab-ui-mailer.js

20 lines
699 B

#!/usr/bin/env node
var defaults = require("../config/mailconfig.js");
var crontab = require("../crontab.js");
var nodemailer = require('nodemailer');
crontab.get_crontab(process.argv[process.argv.length -1 -2], function(job){
var transporter = nodemailer.createTransport(job.mailing.transporterStr);
var mailOptions = job.mailing.mailOptions;
mailOptions.attachments = [{filename: "stdout.txt", path: process.argv[process.argv.length -1 -1]}, {filename: "stderr.txt", path: process.argv[process.argv.length -1]}];
transporter.sendMail(mailOptions, function(error, info){
if(error){
return console.log(error);
}
console.log('Message sent: ' + info.response);
});
});