Email

Email

Source:
See:

Reaction.Email methods for creating e-mail jobs, fetching e-mail templates and e-mail subject lines

Methods

(static) getMailConfig() → {Object}

get the email sending config for Nodemailer

Source:
Example
Reaction.Email.getMailConfig()
Returns:

returns a config object

Type
Object

(static) getMailUrl() → {String}

get the smtp URL for sending emails There are 3 possible ways to set the email configuration and the first value found will be used. The priority order is:

  1. MAIL_URL environment variable
  2. Meteor settings (MAIL_URL key)
  3. Core shop settings from the database

Source:
Example
Reaction.Email.getMailUrl()
Returns:

returns an SMTP url if one of the settings have been set

Type
String

Get absolute URL for shop logo, if available. If not, use default logo URL.

Source:
Parameters:
Name Type Description
shop Object

shop

Returns:

Absolute image URL

Type
String

(static) getSubject(template) → {Object}

Returns a subject source for SSR consumption layout must be defined + template

Source:
Example
SSR.compileTemplate(subject, Reaction.Email.getSubject(tpl));
Parameters:
Name Type Description
template String

name of the template in either Layouts or fs

Returns:

returns source

Type
Object

(static) getTemplate(template) → {Object}

Returns a template source for SSR consumption. layout must be defined + template

Source:
Example
Reaction.Email.getTemplate('path/of/template');
Parameters:
Name Type Description
template String

name of the template in either Layouts or fs

Returns:

returns source

Type
Object

(static) getTemplateFile(file) → {String}

Source:
Parameters:
Name Type Description
file String

name of the template on file system

Returns:

returns source

Type
String

(static) send(options) → {Boolean}

Add send e-mail job to job queue. The worker will then process it immediately (in batches of up to 10) and will retry failures up to 5 times (waiting 3 mins between each try) before failing completely. All email sending attempts are logged in the job collection.

Source:
See:
  • (Job API doc) https://github.com/vsivsi/meteor-job-collection/#user-content-job-api
Example
Reaction.Email.send({
    from: 'me@example.com',
    to: 'you@example.com',
    subject: 'RE: new email API',
    html: SSR.render('some-name', { shopUrl: Reaction.absoluteUrl() })
  });
Parameters:
Name Type Description
options Object

object containing to/from/subject/html String keys

Returns:

returns job object

Type
Boolean

(static) verifyConfig(config, callback) → {Promise}

Verify a transporter configuration works

Source:
See:
Parameters:
Name Type Description
config Object

a Nodemailer transporter config object

callback function

optional callback with standard error/result args

Returns:

returns a Promise if no callback is provided

Type
Promise