First take on the "send from url" feature

This commit is contained in:
Andris Reinman 2016-04-26 19:07:07 +03:00
parent d8b98d2a8b
commit e4c71f4026
9 changed files with 190 additions and 117 deletions

View file

@ -9,6 +9,7 @@ let Handlebars = require('handlebars');
let fs = require('fs');
let path = require('path');
let templates = new Map();
let htmlToText = require('html-to-text');
module.exports.transport = false;
@ -54,6 +55,10 @@ module.exports.sendMail = (mail, template, callback) => {
if (textRenderer) {
mail.text = textRenderer(template.data || {});
} else if (mail.html) {
mail.text = htmlToText.fromString(mail.html, {
wordwrap: 130
});
}
module.exports.transport.sendMail(mail, callback);

View file

@ -8,7 +8,7 @@ let segments = require('./segments');
let subscriptions = require('./subscriptions');
let shortid = require('shortid');
let allowedKeys = ['description', 'from', 'address', 'subject', 'template', 'list', 'segment', 'html', 'text'];
let allowedKeys = ['description', 'from', 'address', 'subject', 'template', 'template_url', 'list', 'segment', 'html', 'text'];
module.exports.list = (start, limit, callback) => {
db.getConnection((err, connection) => {