|
|
@ -69,6 +69,9 @@ EmailService.prototype.start = function(opts, cb) { |
|
|
|
self.defaultLanguage = opts.emailOpts.defaultLanguage || 'en'; |
|
|
|
self.defaultUnit = opts.emailOpts.defaultUnit || 'btc'; |
|
|
|
self.templatePath = path.normalize((opts.emailOpts.templatePath || (__dirname + '/templates')) + '/'); |
|
|
|
self.publicTxUrlTemplate = opts.emailOpts.publicTxUrlTemplate || {}; |
|
|
|
self.subjectPrefix = opts.emailOpts.subjectPrefix || '[Wallet service]'; |
|
|
|
self.from = opts.emailOpts.from; |
|
|
|
|
|
|
|
async.parallel([ |
|
|
|
|
|
|
@ -119,8 +122,6 @@ EmailService.prototype.start = function(opts, cb) { |
|
|
|
}, |
|
|
|
function(done) { |
|
|
|
self.mailer = opts.mailer || nodemailer.createTransport(opts.emailOpts); |
|
|
|
self.subjectPrefix = opts.emailOpts.subjectPrefix || '[Wallet service]'; |
|
|
|
self.from = opts.emailOpts.from; |
|
|
|
done(); |
|
|
|
}, |
|
|
|
], function(err) { |
|
|
@ -255,8 +256,16 @@ EmailService.prototype._getDataForTemplate = function(notification, recipient, c |
|
|
|
} |
|
|
|
|
|
|
|
if (_.contains(['NewIncomingTx', 'NewOutgoingTx'], notification.type) && data.txid) { |
|
|
|
data.urlForTx = self.explorers[wallet.network].getPublicUrlForTx(data.txid); |
|
|
|
var urlTemplate = self.publicTxUrlTemplate[wallet.network]; |
|
|
|
if (urlTemplate) { |
|
|
|
try { |
|
|
|
data.urlForTx = Mustache.render(urlTemplate, data); |
|
|
|
} catch (ex) { |
|
|
|
log.warn('Could not render public url for tx', ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return cb(null, data); |
|
|
|
}); |
|
|
|
}; |
|
|
|