mail-time icon indicating copy to clipboard operation
mail-time copied to clipboard

Callback function not called

Open alex-maxime opened this issue 3 years ago • 0 comments

I'm having an issue:

Hello,

I am trying to use mail-time with a cluster configuration

i have my "Micro-service" who is running runs Mail Time as a Server with the type 'server' in option and my cluster runs Mail Time as a Client with the type 'client' in option.

I would like to log event when e-mail is going but the callback's function when using Mail Time as a Client do not trigger anything

the current fix is to use in both side, the type 'server' in option. but it do not satisfy this :

The main difference between Server and Client type is that the Server handles the queue and sends email. While the Client only adds emails into the queue.

  • Version of mail-time: 1.3.4
  • Version of Node.js : v16.18.1 and NPM : 8.19.2

I have a suggestion:

  • in server mode, add an option onSendMail which is called when callback is empty or when it comes from the client
  • display a warning when a callback is provided in 'clientt' mode (Warning, callback will not be executed in client mode)
new MailTime({
    type: 'server',
     // ... config here
    ...
    onSendMail(error, task, info) {
      nodemailer.getTestMessageUrl(info); // test with Ethereal
    }
});

alex-maxime avatar Jan 14 '23 03:01 alex-maxime