nodemailer / smtp-server

Create custom SMTP servers on the fly
Other
857 stars 145 forks source link

handle missing address in listener handler #107

Closed richRemer closed 6 years ago

richRemer commented 6 years ago

Attempting to use Unix sockets currently leads to the following error:

TypeError: Cannot read property 'address' of null
    at SMTPServer._onListening (/usr/local/lib/node_modules/smtp-redis-dropbox/node_modules/smtp-server/lib/smtp-server.js:291:30)
    at Server.server.once (/usr/local/lib/node_modules/smtp-redis-dropbox/node_modules/smtp-server/lib/smtp-server.js:273:52)
    at Server.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at Server.emit (events.js:185:7)
    at emitListeningNT (net.js:1288:10)
    at _combinedTickCallback (internal/process/next_tick.js:77:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3

This is because when using a Unix socket (for example, when using socket activation with systemd), the resulting address is null.

It does not appear smtp-server is using the address except for logging, so this change simply logs null values instead of throwing.

richRemer commented 6 years ago

Any chance of publishing this to npm? Pretty please?

andris9 commented 6 years ago

Sorry for the delay, published as v3.4.2