How to send emails from multiple SMTP servers


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?



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


I will use this im my project…


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