const TAG = 'mailer';
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 @@
const TAG = 'mailer';
Mailer = {
settings: {
silent: false,
@@ -142,13 +142,13 @@ Setup
return this;
}
};
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
});
const addHelpers = (template) => {
check(template.name, String);
check(template.helpers, Match.Optional(Object));
return Template[template.name].helpers(_.extend({}, globalHelpers, template.helpers));
};
const compile = (template) => {
check(template, Match.ObjectIncluding({
path: String,
@@ -294,13 +294,13 @@ Compile
addHelpers(layout);
}
const tmpl = SSR.compileTemplate(template.name, content, {
language: settings.language
});
Add helpers to template.
addHelpers(template);
return tmpl;
};
const render = (templateName, data) => {
check(templateName, String);
check(data, Match.Optional(Object));
@@ -370,13 +370,13 @@ Render
let preview = null;
let css = null;
if (tmpl.__helpers.has('preview')) {
preview = tmpl.__helpers.get('preview');
} else if (data.preview) {
preview = data.preview;
}
if (template.extraCSS) {
try {
css = Utils.readFile(template.extraCSS);
@@ -432,13 +432,13 @@ Render
rendered = Utils.addDoctype(rendered);
return rendered;
};
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);
try {
opts.html = render(options.template, options.data);
if (settings.plainText) {
@@ -525,13 +527,13 @@ Send
init
};
};
Mailer.init = function(opts) {
const obj = _.extend(this, factory(opts));
@@ -550,9 +552,9 @@ Send
obj.init();
};