nest-modules / mailer

📨 A mailer module for Nest framework (node.js)
https://nest-modules.github.io/mailer/
MIT License
840 stars 176 forks source link

lib/mailer.service.ts#L23 private to public? #1171

Open junxiaotan opened 5 months ago

junxiaotan commented 5 months ago

内部一些privaite属性,建议改为public,例如 transports,我想通过这个实现如果已有就不再xxxx。

juandav commented 5 months ago

Maybe I can implement a function to get the transports, what do you think?

I'm open to suggestions

junxiaotan commented 4 months ago

Sure! as long as it can be exposed, it's good

yusufkandemir commented 4 months ago

We need a way to access the transports to be able to use Nodemailer plugins by doing transport.use('compile', plugin). I see two ways of doing this:

  1. expose the transports
  2. accept a list of plugins to add:
    {
    /** whether to add the plugin before or after the template compilation plugin */
    position: 'append' | 'prepend';
    /** First parameter to be used in transport.use(step, plugin) */
    step: 'compile' | 'stream';
    plugin: import('nodemailer/lib/mailer').PluginFunction;
    }[]

    Also, both can be done at the same time. This would make it easier to add plugins via configuration and allow other advanced use cases by directly accessing the transports.