Skip to content
Snippets Groups Projects
Commit 65391161 authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

:sparkles: Feature: pushed the templates into the mailer component because that makes more sense

parent d2408e72
No related branches found
No related tags found
No related merge requests found
Showing
with 2982 additions and 14 deletions
This diff is collapsed.
Hi {{{ NAME }}}!
{{{ SENDER }}} just invited you to the {{{ ROOMURI }}} community chat room on Gitter.
Click here to join the conversation: https://gitter.im/{{{ ROOMURI }}}.
What is Gitter you ask? Reasonable question. Gitter is where developers come to talk. We host thousands of free public communities where software developers around the world come together to interact. We also offer private conversations for teams and businesses.
We built Gitter specifically for developers, with awesome features like markdown support and syntax highlighting as well as deep integration with GitHub and other services.
We hope you'll love it.
You can find out more at https://gitter.im
This diff is collapsed.
Hi {{{ NAME }}}!
{{{ SENDER }}} just invited you to the {{{ ROOMURI }}} community chat room on Gitter.
Click here to join the conversation: https://gitter.im/{{{ ROOMURI }}}.
What is Gitter you ask? Reasonable question. Gitter is where developers come to talk. We host thousands of free public communities where software developers around the world come together to interact. We also offer private conversations for teams and businesses.
We built Gitter specifically for developers, with awesome features like markdown support and syntax highlighting as well as deep integration with GitHub and other services.
We hope you'll love it.
You can find out more at https://gitter.im
{{{ HTML }}}
{{{ PLAINTEXT }}}
{{{ HTML }}}
{{{ PLAINTEXT }}}
{{{ HTML }}}
{{{ PLAINTEXT }}}
This diff is collapsed.
Hi there,
This is what you missed while you were away.
{{{ PLAINTEXT }}}
Kind regards,
Gitter
--
To unsubscribe from these notifications, click here: {{{ UNSUB }}}
--
Follow us on Twitter
twitter.com/gitchat
Loading
Loading
@@ -4,12 +4,13 @@ var Promise = require('bluebird');
var HandlebarsMemoizer = require('./templates/handlebars-memoizer');
var path = require('path');
 
var LEGACY_MANDRILL_TEMPLATES = 'legacy_mandrill_templates';
function NodeMailerMailer(transporter, options) {
this.transporter = transporter;
this.logger = options.logger;
this.stats = options.stats;
this.config = options.config;
this.templateDirectory = this.config.get('mailer:templateDirectory');
 
this.defaultFromEmailName = options.defaultFromEmailName;
this.defaultFromEmailAddress = options.defaultFromEmailAddress;
Loading
Loading
@@ -59,8 +60,11 @@ NodeMailerMailer.prototype.send = Promise.method(function(options) {
 
 
NodeMailerMailer.prototype.applyTemplates = Promise.method(function(templateName, data) {
var templateHtmlFilename = path.resolve(this.templateDirectory, templateName + '_html.hbs');
var templateTextFilename = path.resolve(this.templateDirectory, templateName + '_text.hbs');
/*
* These will get replaced at a later stage with a more flexible scheme
*/
var templateHtmlFilename = path.join(__dirname, LEGACY_MANDRILL_TEMPLATES, templateName + '_html.hbs');
var templateTextFilename = path.join(__dirname, LEGACY_MANDRILL_TEMPLATES, templateName + '_text.hbs');
 
return Promise.join(
this.handlebarsCache.get(templateHtmlFilename),
Loading
Loading
Loading
Loading
@@ -4,8 +4,5 @@
"secretAccessKey": "",
"defaultFromEmailName": "Gitter",
"defaultFromEmailAddress": "support@gitter.im"
},
"mailer": {
"templateDirectory": "templates/"
}
}
Loading
Loading
@@ -5,9 +5,9 @@ var env = require('../../..').create(__dirname);
var mailer = env.mailer;
 
return mailer({
templateName: 'text',
templateName: 'added-to-room',
subject: 'Hi There',
to: 'mike@gitter.im',
to: 'andrew@gitter.im',
data: {
FIRST_NAME: 'Mike'
}
Loading
Loading
<p>HELLO {{ FIRST_NAME }}</p>
<p><b>Moenie a hond wies nie</b></p>
HELLO {{ FIRST_NAME }}
Moenie a hond wies nie.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment