/Meteor 1.4


Documentation of Meteor's email API.

The email package allows sending email from a Meteor app. To use it, add the package to your project by running in your terminal:

meteor add email

The server reads from the MAIL_URL environment variable to determine how to send mail. Currently, Meteor supports sending mail over SMTP; the MAIL_URL environment variable should be of the form smtp://USERNAME:PASSWORD@HOST:PORT.

If MAIL_URL is not set, Email.send outputs the message to standard output instead.

import { Email } from 'meteor/email' (email/email.js, line 166)

Send an email. Throws an Error on failure to contact mail server or if mail server returns an error. All fields should match RFC5322 specification.

If the MAIL_URL environment variable is set, actually sends the email. Otherwise, prints the contents of the email to standard out.

Note that this package is based on mailcomposer version 4.0.1, so make sure to refer to the documentation for that version if using the attachments or mailComposer options. Click here to read the mailcomposer 4.0.1 docs.


from String

"From:" address (required)

to, cc, bcc, replyTo String or Array of Strings

"To:", "Cc:", "Bcc:", and "Reply-To:" addresses

inReplyTo String

Message-ID this message is replying to

references String or Array of Strings

Array (or space-separated string) of Message-IDs to refer to

messageId String

Message-ID for this message; otherwise, will be set to a random value

subject String

"Subject:" line

text, html String

Mail body (in plain text and/or HTML)

watchHtml String

Mail body in HTML specific for Apple Watch

icalEvent String

iCalendar event attachment

headers Object

Dictionary of custom headers

attachments Array of Objects

Array of attachment objects, as described in the mailcomposer documentation.

mailComposer MailComposer

A MailComposer object (or its compile() output) representing the message to be sent. Overrides all other options. You can access the mailcomposer npm module at EmailInternals.NpmModules.mailcomposer.module. This module is a function which assembles a MailComposer object and immediately compile()s it. Alternatively, you can create and pass a MailComposer object via new EmailInternals.NpmModules.mailcomposer.module.MailComposer.

You must provide the from option and at least one of to, cc, and bcc; all other options are optional.

Email.send only works on the server. Here is an example of how a client could use a server method call to send an email. (In an actual application, you’d need to be careful to limit the emails that a client could send, to prevent your server from being used as a relay by spammers.)

// Server: Define a method that the client can call.
  sendEmail(to, from, subject, text) {
    // Make sure that all arguments are strings.

    check([to, from, subject, text], [String]);

    // Let other method calls from the same client start running, without

    // waiting for the email sending to complete.


    Email.send({ to, from, subject, text });

// Client: Asynchronously send an email.
  'Hello from Meteor!',
  'This is a test of Email.send.'


© 2011–2016 Meteor Development Group
Licensed under the MIT License.