diff --git a/backend/src/middleware/helpers/email/sendMail.js b/backend/src/middleware/helpers/email/sendMail.js index a1b3b238a..3fc1e2931 100644 --- a/backend/src/middleware/helpers/email/sendMail.js +++ b/backend/src/middleware/helpers/email/sendMail.js @@ -9,7 +9,7 @@ const hasAuthData = CONFIG.SMTP_USERNAME && CONFIG.SMTP_PASSWORD // let sendMailCallback = async () => {} // Wolle let sendMailCallback = async (templateArgs) => { - console.log('templateArgs: ', templateArgs) + // console.log('templateArgs: ', templateArgs) } if (!hasEmailConfig) { if (!CONFIG.TEST) { @@ -19,7 +19,7 @@ if (!hasEmailConfig) { } else { sendMailCallback = async (templateArgs) => { // Wolle - console.log('templateArgs: ', templateArgs) + // console.log('templateArgs: ', templateArgs) const transporter = nodemailer.createTransport({ host: CONFIG.SMTP_HOST, port: CONFIG.SMTP_PORT, diff --git a/backend/src/middleware/helpers/email/templateBuilder.js b/backend/src/middleware/helpers/email/templateBuilder.js index f37e89a4b..dd4985327 100644 --- a/backend/src/middleware/helpers/email/templateBuilder.js +++ b/backend/src/middleware/helpers/email/templateBuilder.js @@ -1,5 +1,6 @@ import mustache from 'mustache' import CONFIG from '../../../config' +import metadata from '../../../config/metadata.js' import logosWebapp from '../../../config/logos.js' import * as templates from './templates' @@ -10,11 +11,13 @@ const from = CONFIG.EMAIL_DEFAULT_SENDER const welcomeImageUrl = new URL(logosWebapp.LOGO_WELCOME_PATH, CONFIG.CLIENT_URI) const defaultParams = { - supportUrl: CONFIG.SUPPORT_URL, - APPLICATION_NAME: CONFIG.APPLICATION_NAME, - ORGANIZATION_URL: CONFIG.ORGANIZATION_URL, welcomeImageUrl, + APPLICATION_NAME: CONFIG.APPLICATION_NAME, + ORGANIZATION_NAME: metadata.ORGANIZATION_NAME, + ORGANIZATION_URL: CONFIG.ORGANIZATION_URL, + supportUrl: CONFIG.SUPPORT_URL, } +const englishHint = 'English version below!' export const signupTemplate = ({ email, nonce, inviteCode = null }) => { const subject = `Willkommen, Bienvenue, Welcome to ${CONFIG.APPLICATION_NAME}!` @@ -35,7 +38,7 @@ export const signupTemplate = ({ email, nonce, inviteCode = null }) => { subject, html: mustache.render( templates.layout, - { ...defaultParams, actionUrl, nonce, subject }, + { ...defaultParams, englishHint, actionUrl, nonce, subject }, { content: templates.signup }, ), } @@ -53,7 +56,7 @@ export const emailVerificationTemplate = ({ email, nonce, name }) => { subject, html: mustache.render( templates.layout, - { ...defaultParams, actionUrl, name, nonce, subject }, + { ...defaultParams, englishHint, actionUrl, name, nonce, subject }, { content: templates.emailVerification }, ), } @@ -65,13 +68,22 @@ export const resetPasswordTemplate = ({ email, nonce, name }) => { actionUrl.searchParams.set('nonce', nonce) actionUrl.searchParams.set('email', email) + // Wolle + // console.log( + // mustache.render( + // templates.layout, + // { ...defaultParams, englishHint, actionUrl, name, nonce, subject }, + // { content: templates.passwordReset }, + // ), + // ) + return { from, to: email, subject, html: mustache.render( templates.layout, - { ...defaultParams, actionUrl, name, nonce, subject }, + { ...defaultParams, englishHint, actionUrl, name, nonce, subject }, { content: templates.passwordReset }, ), } @@ -87,16 +99,16 @@ export const wrongAccountTemplate = ({ email }) => { subject, html: mustache.render( templates.layout, - { ...defaultParams, actionUrl, supportUrl: CONFIG.SUPPORT_URL, welcomeImageUrl }, + { ...defaultParams, englishHint, actionUrl }, { content: templates.wrongAccount }, ), } } export const notificationTemplate = ({ email, notification }) => { + // TODO Wolle language const subject = `${CONFIG.APPLICATION_NAME} – Benachrichtigung | Notification` const actionUrl = new URL('/notifications', CONFIG.CLIENT_URI) - // TODO Wolle language let content switch (notification.to.locale) { case 'de': @@ -111,13 +123,22 @@ export const notificationTemplate = ({ email, notification }) => { break } + // Wolle + // console.log( + // mustache.render( + // templates.layout, + // { ...defaultParams, name: notification.to.name, actionUrl }, + // { content }, + // ), + // ) + return { from, to: email, subject, html: mustache.render( templates.layout, - { ...defaultParams, actionUrl, supportUrl: /* Wolle */ CONFIG.SUPPORT_URL, welcomeImageUrl }, + { ...defaultParams, name: notification.to.name, actionUrl }, { content }, ), } diff --git a/backend/src/middleware/helpers/email/templates/de/notification.html b/backend/src/middleware/helpers/email/templates/de/notification.html index cb566099e..24e2257e0 100644 --- a/backend/src/middleware/helpers/email/templates/de/notification.html +++ b/backend/src/middleware/helpers/email/templates/de/notification.html @@ -23,9 +23,9 @@ style="padding: 20px; padding-top: 0; font-family: Lato, sans-serif; font-size: 16px; line-height: 22px; color: #555555;">
Du hast mindestens eine Banachrichtigung bekommen! Mit Klick auf diesen Button - kannst Du deine Nachrichten ansehen:
+ Hallo {{ name }}, +Du hast mindestens eine Benachrichtigung erhalten. Klick auf diesen Button, + um sie anzusehen:
|
+ Bis bald bei {{APPLICATION_NAME}}! +– Dein {{APPLICATION_NAME}} Team |
| Retrieve + style="background: #17b53e; font-family: Lato, sans-serif; font-size: 16px; line-height: 15px; text-decoration: none; padding: 13px 17px; color: #ffffff; display: block; border-radius: 4px;">View notifications |
|
+ See you soon on {{APPLICATION_NAME}}! +– The {{APPLICATION_NAME}} Team |
English version below!
+{{englishHint}}
{{> content}} @@ -169,10 +169,11 @@