Closed eatthoselemons closed 7 years ago
You are passing in an object, so it is going with options.logger
. Since you are only passing debug none of the other three are getting passed functions. I will record this as a bug because it should default on the other ones even if you only pass in the debug. To fix it for now just do not pass any options in so it uses all of the console options
const logger = options.logger || (options.silent && {
debug: dummy,
info: dummy,
warn: dummy,
error: dummy
} || {
debug: console.log,
info: console.info,
warn: console.warn,
error: console.error
})
Getting logger.error is not a function
Expected Behavior
I would expect to see an error of some sort or some indication of success that is not happening though
Current Behavior
Right now I am getting an error on what I assume is trying to report an error, the output of the command
node test.js
gives this output:`mx resolved: [ { exchange: 'alt4.gmail-smtp-in.l.google.com', priority: 40 }, { exchange: 'alt3.gmail-smtp-in.l.google.com', priority: 30 }, { exchange: 'alt2.gmail-smtp-in.l.google.com', priority: 20 }, { exchange: 'alt1.gmail-smtp-in.l.google.com', priority: 10 }, { exchange: 'gmail-smtp-in.l.google.com', priority: 5 } ] /home/eat_those_lemons/.local/lib/node_modules/sendmail/sendmail.js:91 logger.error('Error on connectMx for: ', data[i], err) ^
TypeError: logger.error is not a function at Socket. (/home/eat_those_lemons/.local/lib/node_modules/sendmail/sendmail.js:91:20)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at emitErrorNT (net.js:1281:8)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)`
The contents of test.js: 'var sendmail = require('../sendmail')({logger: {debug: console.log}, silent: false})//, devPort: 5555})
sendmail({ from: 'email_I_am_testing', to: 'myemail', replyTo: 'email', subject: 'MailComposer sendmail', html: 'Mail of test sendmail ' }, function (err, reply) { console.log(err && err.stack) console.dir(reply) })`
Context
I am trying to see if Gmail is dropping the emails I am sending its way to check if my email server is working. I am first trying to send over the localhost on port 5555 which is what I have the smtp server listening on and sending out on since my isp blocks port 25 which I am in contact with them to fix but in the meantime checking to make sure that everything else works)
I am also getting that logger.info is not a function both from
/home/my_username/.local/lib/node_modules/sendmail/sendmail.js
Your Environment
Ubuntu 16.10 npm 4.0.5 node 7.4.0