diff --git a/docs/mailer.html b/docs/mailer.html index 5cf7a28..b3677c0 100644 --- a/docs/mailer.html +++ b/docs/mailer.html @@ -10,51 +10,51 @@
- + - +
- +
Mailer = {
   settings: {
     silent: false,
@@ -142,13 +142,13 @@ 

Setup

return this; } };
- + - - + +
  • - +
    @@ -163,53 +163,53 @@

    The factory

    with data, as well as sending emails from those templates.

    - +
    const factory = (options) => {
       check(options, Match.ObjectIncluding({
    - +
  • - - + +
  • - +

    Mailer must take a templates object with template names as keys.

    - +
        templates: Object,
    - +
  • - - + +
  • - +

    Take optional template helpers.

    - +
        helpers: Match.Optional(Object),
    - +
  • - - + +
  • - +

    Take an optional layout template object.

    - +
        layout: Match.Optional(Match.OneOf(Object, Boolean))
       }));
     
    @@ -221,13 +221,13 @@ 

    The factory

    Utils.setupLogger(settings.logger, { suppressInfo: settings.silent });
    - +
  • - - + +
  • - +
    @@ -236,19 +236,19 @@

    The factory

    the template.

    - +
      const addHelpers = (template) => {
         check(template.name, String);
         check(template.helpers, Match.Optional(Object));
         return Template[template.name].helpers(_.extend({}, globalHelpers, template.helpers));
       };
    - +
  • - - + +
  • - +
    @@ -260,7 +260,7 @@

    Compile

    can optionally have paths to any SCSS and CSS stylesheets.

    - +
      const compile = (template) => {
         check(template, Match.ObjectIncluding({
           path: String,
    @@ -294,13 +294,13 @@ 

    Compile

    addHelpers(layout); }
    - +
  • - - + +
  • - +
    @@ -308,34 +308,34 @@

    Compile

    Template.<template.name>
     
    - +
        const tmpl = SSR.compileTemplate(template.name, content, {
           language: settings.language
         });
    - +
  • - - + +
  • - +

    Add helpers to template.

    - +
        addHelpers(template);
         return tmpl;
       };
    - +
  • - - + +
  • - +
    @@ -344,7 +344,7 @@

    Render

    Will compile the template if not done already.

    - +
      const render = (templateName, data) => {
         check(templateName, String);
         check(data, Match.Optional(Object));
    @@ -370,13 +370,13 @@ 

    Render

    let preview = null; let css = null;
    - +
  • - - + +
  • - +
    @@ -387,19 +387,19 @@

    Render

    preview prop in the data context to apply to the layout.

    - +
          if (tmpl.__helpers.has('preview')) {
             preview = tmpl.__helpers.get('preview');
           } else if (data.preview) {
             preview = data.preview;
           }
    - +
  • - - + +
  • - +
    @@ -407,7 +407,7 @@

    Render

    the layout in <style> tags. Ideal for media queries.

    - +
          if (template.extraCSS) {
             try {
               css = Utils.readFile(template.extraCSS);
    @@ -432,13 +432,13 @@ 

    Render

    rendered = Utils.addDoctype(rendered); return rendered; };
    - +
  • - - + +
  • - +
    @@ -447,12 +447,14 @@

    Send

    including the template name and optional data object.

    - +
      const sendEmail = (options) => {
         check(options, {
           to: String,
           subject: String,
           template: String,
    +      cc: Match.Optional(String),
    +      bcc: Match.Optional(String),
           replyTo: Match.Optional(String),
           from: Match.Optional(String),
           data: Match.Optional(Object),
    @@ -468,13 +470,13 @@ 

    Send

    } const opts = _.extend({}, defaults, options);
    - +
  • - - + +
  • - +
    @@ -482,7 +484,7 @@

    Send

    create plain-text version from HTML.

    - +
        try {
           opts.html = render(options.template, options.data);
           if (settings.plainText) {
    @@ -525,13 +527,13 @@ 

    Send

    init }; };
    - +
  • - - + +
  • - +
    @@ -540,7 +542,7 @@

    Send

    inner init() function.

    - +
    Mailer.init = function(opts) {
       const obj = _.extend(this, factory(opts));
     
    @@ -550,9 +552,9 @@ 

    Send

    obj.init(); };
    - +
  • - + diff --git a/lib/mailer.js b/lib/mailer.js index e51052a..79d5882 100644 --- a/lib/mailer.js +++ b/lib/mailer.js @@ -227,6 +227,8 @@ const factory = (options) => { to: String, subject: String, template: String, + cc: Match.Optional(String), + bcc: Match.Optional(String), replyTo: Match.Optional(String), from: Match.Optional(String), data: Match.Optional(Object),