Hi.
Now I think I have tried all I know and still cannot get it to send a email to me. Hopefully someone can tell me what I have done wrong.
I have tried both aol and my own ISP SMTP without success.
gateway.js
//var transporter = nodemailer.createTransport({
// service: 'Aol', //"gmail" is preconfigured by nodemailer, but you can setup any other email client supported by nodemailer
// auth: {
// user: 'a*****.*.b*****@aol.com',
// pass: '*******'
// }
// });
var transporter = nodemailer.createTransport("SMTP", {
host: "mh.ve***.**", // hostname
secureConnection: false, // use SSL
port: 25, // port for secure SMTP
auth: {
user: "a***.b***@ve***.***",
pass: "*************"
}
});
global.LOG = function(data) { process.stdout.write(data || ''); }
global.LOGln = function(data) { process.stdout.write((data || '') + '\n'); }
global.sendEmail = function(SUBJECT, BODY) {
var mailOptions = {
from: 'House <a***.b***@ve***.***>',
to: 'a***@e*****.o**', // list of receivers, comma separated
subject: House,
text: BODY
//html: '<b></b>' // html body
And added this line to metrics.js to send when Status is Open
mailboxEmail : { label:'Mailbox : Email', icon:'mail', descr:'Send email when MAILBOX is open', serverExecute:function(node) { if (node.metrics['Status'] && node.metrics['Status'].value == 'OPEN' && (Date.now() - new Date(node.metrics['Status'].updated).getTime() < 2000)) { sendEmail('MAILBOX OPENED', 'MAILBOX ACTIVITY WAS DETECTED ON NODE: [' + node._id + '] ' + node.label); }; } },
Have I missed anything?
Thanks for your help!
First I would isolate the email functionality to ensure that a dummy email can be sent to yourself or whatever target email address.
Once that works then you can worry about the metric that will do the actual sending.
I have only ever tried GMAIL as an email client with nodemailer. It has always worked fine except in cases where the password was wrong etc.
So I would test the email sending function first (just replace gateway.js with a dummy version that just calls the email function and does nothing else after that).