Enable html mails for box updates

This commit is contained in:
Johannes
2016-11-07 12:32:57 +01:00
parent bf2885d7d3
commit 45b83232d7
2 changed files with 46 additions and 1 deletions

View File

@@ -393,11 +393,26 @@ function boxUpdateAvailable(newBoxVersion, changelog) {
getAdminEmails(function (error, adminEmails) {
if (error) return console.log('Error getting admins', error);
var templateData = {
fqdn: config.fqdn(),
webadminUrl: config.adminOrigin(),
newBoxVersion: newBoxVersion,
changelog: changelog,
cloudronAvatarUrl: config.adminOrigin() + '/api/v1/cloudron/avatar'
};
var templateDataText = JSON.parse(JSON.stringify(templateData));
templateDataText.format = 'text';
var templateDataHTML = JSON.parse(JSON.stringify(templateData));
templateDataHTML.format = 'html';
var mailOptions = {
from: mailConfig().from,
to: adminEmails.join(', '),
subject: util.format('%s has a new update available', config.fqdn()),
text: render('box_update_available.ejs', { fqdn: config.fqdn(), webadminUrl: config.adminOrigin(), newBoxVersion: newBoxVersion, changelog: changelog, format: 'text' })
text: render('box_update_available.ejs', templateDataText),
html: render('box_update_available.ejs', templateDataHTML)
};
enqueue(mailOptions);