Send emails from different smtps

Hi all!

Currently I’m trying to create a sort of email hub. And I need to know how to send emails from many SMTP servers, that are configured by the user.

There is a idiomatic way to do this in meteor?

Thanks!

Meteor’s default Email API relies on a MAIL_URL environment variable, to get the needed SMTP host/user/pass/port information. Your application can change (some) server environment variables like MAIL_URL on the fly:

process.env.MAIL_URL = 'smtp://USERNAME:PASSWORD@HOST:PORT/';

You should be able to store the SMTP details for each user in your DB, then load/set the MAIL_URL for each user just before sending out any emails.

2 Likes

Thank you for your answer! :slight_smile: