diff --git a/src/mail_templates/welcome_user.ejs b/src/mail_templates/welcome_user-html.ejs similarity index 60% rename from src/mail_templates/welcome_user.ejs rename to src/mail_templates/welcome_user-html.ejs index f443f22ee..0a49b7384 100644 --- a/src/mail_templates/welcome_user.ejs +++ b/src/mail_templates/welcome_user-html.ejs @@ -1,22 +1,3 @@ -<%if (format === 'text') { %> - -Dear <%= user.displayName || user.username || user.email %>, - -Welcome to <%= cloudronName %>! - -Follow the link to get started. -<%- inviteLink %> - -<% if (invitor && invitor.email) { %> -You are receiving this email because you were invited by <%= invitor.email %>. -<% } %> - -Please note that the invite link will expire in 7 days. - -Powered by https://cloudron.io - -<% } else { %> -
@@ -46,5 +27,3 @@ Powered by https://cloudron.io
- -<% } %> diff --git a/src/mail_templates/welcome_user-text.ejs b/src/mail_templates/welcome_user-text.ejs new file mode 100644 index 000000000..a0f8aa73a --- /dev/null +++ b/src/mail_templates/welcome_user-text.ejs @@ -0,0 +1,14 @@ +Dear <%= user.displayName || user.username || user.email %>, + +Welcome to <%= cloudronName %>! + +Follow the link to get started. +<%- inviteLink %> + +<% if (invitor && invitor.email) { %> +You are receiving this email because you were invited by <%= invitor.email %>. +<% } %> + +Please note that the invite link will expire in 7 days. + +Powered by https://cloudron.io diff --git a/src/mailer.js b/src/mailer.js index ac041e550..7e98d149e 100644 --- a/src/mailer.js +++ b/src/mailer.js @@ -144,18 +144,12 @@ function sendInvite(user, invitor, inviteLink) { cloudronAvatarUrl: settings.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.notificationFrom, to: user.fallbackEmail, subject: util.format('Welcome to %s', mailConfig.cloudronName), - text: render('welcome_user.ejs', templateDataText), - html: render('welcome_user.ejs', templateDataHTML) + text: render('welcome_user-text.ejs', templateData), + html: render('welcome_user-html.ejs', templateData) }; sendMail(mailOptions);