Closed strugee closed 6 years ago
And thanks for maintaining NodeMailer, btw <3
The "event" part of SMTPServer includes informational events like 'connect' etc. The callbacks you need to register are not informational but transactional and thus can't be really treated the same way events are treated. You are supposed to call your own handlers from the callback and return the result of the operation. You can see here a real-life example of setting up the callbacks
I'm very confused as to how this module is supposed to work. It seems like instances of
SMTPServer
are EventEmitters, but the events that it emits aren't documented? AFAICT you're supposed to pass callbacks at construction time but this really does not work great because sometimes you want to register listeners later (this is my use case because of the way my test suite is set up) or you want to useemitter.once
instead ofemitter.on
. The current design is super confusing and inconsistent because there are a couple events you can listen for, but AFAICT most things have to be done with theon*
options passed to the server constructor.Let me know if I'm missing something obvious.