How to send emails from multiple SMTP servers


#1

I am used to send emails from Meteor apps using the MAIL_URL environment variable like this: smtps://USERNAME:PASSWORD@HOST:PORT.

But now I need to send emails from different SMTP configurations (the username and password changes depending where I send the email from the app).

How can I do it? I guess I need to edit the env var MAIL_URL while the app is running. Can I do it?

Thanks


#2

If you need to use multiple servers, you should import nodemailer or another npm package for email and define your behaviour there. You’ll have a much better time than trying to dynamically change env vars just so you can use the builtin package


#3

I will use this im my project…
https://atmospherejs.com/ostrio/mailer


#4

Thank @raragao, but I tried using nodemailer directly as suggested by @coagmano and it is working perfectly. :slight_smile: