fzaninotto / uptime

A remote monitoring application using Node.js, MongoDB, and Twitter Bootstrap.
http://fzaninotto.github.com/uptime/
MIT License
3.62k stars 707 forks source link

Error facing while using email plugin #354

Open nikhilve99 opened 7 years ago

nikhilve99 commented 7 years ago

Hi team,, we have just configure uptime tool in our environment. its working properly but when we are enabling the plugin for email notification i am getting below error:


11:05:49 AM CTRLS - Deviceview EXE is now up /root/uptime/node_modules/mongoose/lib/utils.js:413 throw err; ^

TypeError: this.mailcomposer.setMessageOption is not a function at Nodemailer.setGeneralOptions (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:238:23) at Nodemailer.generateMailObject (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:196:10) at Nodemailer.sendMail (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:184:10) at /root/uptime/node_modules/nodemailer/lib/nodemailer.js:69:20 at Nodemailer.validateSettings (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:173:5) at sendMail (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:63:12) at Transport.transport.sendMail (/root/uptime/node_modules/nodemailer/lib/nodemailer.js:40:9) at Promise. (/root/uptime/plugins/email/index.js:81:14) at Promise. (/root/uptime/node_modules/mpromise/lib/promise.js:162:8) at emitOne (events.js:96:13)


Here is my config/default.yaml file conf below:

plugins:

email: method: SMTP # possible methods are SMTP, SES, or Sendmail transport: # see https://github.com/andris9/nodemailer for transport options service: Gmail # see https://github.com/andris9/Nodemailer/blob/master/lib/wellknown.js for well-known services auth: user: nikhilv@smartgeek.in # The email account username, e.g. 'username@gmail.com' pass: '***' # The email account password, e.G. 'password' event: up: true down: true paused: false restarted: false message: from: monitor@smartgeek.in # The message sender, e.g. 'Fred Foo foo@blurdybloop.com' to: nikhilv@smartgeek.in # The message recipient, e.g. 'bar@blurdybloop.com, baz@blurdybloop.com'

The email plugin also uses the main url param for hyperlinks in the sent email.

================================================================================= I have configured postfix mail server which is working properly.

Kindly help to resolve this issue.

Regards Nikhil

kimaniidaniel commented 7 years ago

I got that error fixed by upgrading nodemailer to version 3.1.5 and changing a line in the plugin nano ./uptime/plugins/email/index.js

var mailer = nodemailer.createTransport(config.transport);
//var mailer = nodemailer.createTransport(config.method, config.transport);

Check out my full tutorial here - http://www.kimaniidaniel.com/website-monitoring-using-headless-raspberry-pi/