Sending emails with Meteor

Setup of MAIL_URL

Meteor is automatically reading the address of the email server it will send emails from the environment variable MAIL_URL. The URL has the following structure:

smtp://user:password@host:port

To add the environment variable, run the following command or add it through your dashboard

scalingo env-set MAIL_URL=<smtp_url>

More information in the official Meteor documentation

Snippet to send an email with Meteor

recipient = "user@example.com"
Email.send({
  from: process.env.EMAIL_FROM,
  to: recipient,
  subject: "Test email to " + recipient,
  text: "Hello " + recipient + "\n\nThis is a simple test email\n"
});

Automatically Meteor will use the MAIL_URL server address and send the email.

Use of an external SMTP server

Scalingo is not an email server provider, as this is an entirely other job we encourage you to use services specialized into that. Here is a list containing a few actors on the market of email as a service:

This list is not exclusive, but all of them will work perfectly with Scalingo. In each case, create an account, register a new sending domain and sending address and build the MAIL_URL from the credentials given by the provider.

schedule 09 Nov 2015