adonisjs / mail

AdonisJS Email Provider
MIT License
106 stars 34 forks source link

Dynamic SMTP Server #55

Closed TranceGeniK closed 4 years ago

TranceGeniK commented 4 years ago

Is there a way to set the smtp server (and user/password) at runtime ?

thetutlage commented 4 years ago

Which version of the mail package are you using?

TranceGeniK commented 4 years ago

3.0.10

TranceGeniK commented 4 years ago

Any idea ?

thetutlage commented 4 years ago

Hey. Sorry for the late reply. I don't see any direct way to create runtime drivers instances with different config. One way is to register the config at runtime. For example: If you have multiple tenants, then you can use the tenantId to register the config like this.

Config.set('mail.tenant1', {
  // config goes here
})

And then use it as

Mail.driver('tenant1').send()
TranceGeniK commented 4 years ago

Thanks, will try !