diff --git a/java/com.sap.sailing.server/resources/stringmessages/StringMessages.properties b/java/com.sap.sailing.server/resources/stringmessages/StringMessages.properties index 50bfe7289f4..1cca8467120 100644 --- a/java/com.sap.sailing.server/resources/stringmessages/StringMessages.properties +++ b/java/com.sap.sailing.server/resources/stringmessages/StringMessages.properties @@ -30,4 +30,5 @@ boatClassUpcomingRaceBody=For boat class {0} {1} will start approximately at {2} subscriptionInformation=You are receiving notifications from SAP Sailing Analytics. To turn off notifications, please visit your profile at the link below. userProfile=User Profile imprint=Imprint -privacy=Privacy \ No newline at end of file +privacy=Privacy +salutation=Hallo {0}, \ No newline at end of file diff --git a/java/com.sap.sailing.server/resources/stringmessages/StringMessages_de.properties b/java/com.sap.sailing.server/resources/stringmessages/StringMessages_de.properties index 83b3f691df5..33863a527f0 100644 --- a/java/com.sap.sailing.server/resources/stringmessages/StringMessages_de.properties +++ b/java/com.sap.sailing.server/resources/stringmessages/StringMessages_de.properties @@ -31,3 +31,4 @@ subscriptionInformation=Bei dieser Mail handelt es sich um eine automatisierte B userProfile=Benutzerprofil imprint=Impressum privacy=Datenschutzerklärung +salutation=Hallo {0}, \ No newline at end of file diff --git a/java/com.sap.sailing.server/src/com/sap/sailing/server/notification/impl/NotificationSetNotification.java b/java/com.sap.sailing.server/src/com/sap/sailing/server/notification/impl/NotificationSetNotification.java index cff429014fb..696aab0aca7 100644 --- a/java/com.sap.sailing.server/src/com/sap/sailing/server/notification/impl/NotificationSetNotification.java +++ b/java/com.sap.sailing.server/src/com/sap/sailing/server/notification/impl/NotificationSetNotification.java @@ -23,6 +23,7 @@ import com.sap.sse.i18n.impl.ResourceBundleStringMessagesImpl; import com.sap.sse.mail.MailService; import com.sap.sse.mail.queue.MailNotification; import com.sap.sse.security.PreferenceObjectBasedNotificationSet; +import com.sap.sse.security.User; public abstract class NotificationSetNotification implements MailNotification { private static final Logger logger = Logger.getLogger(NotificationSetNotification.class.getName()); @@ -86,7 +87,7 @@ public abstract class NotificationSetNotification implements MailNotification try { // TODO: add cid:saplogo NotificationMailTemplate mailTemplate = getMailTemplate(objectToNotifyAbout, locale); - bodyPart.setContent(getMailContent(mailTemplate, locale), "text/html"); + bodyPart.setContent(getMailContent(mailTemplate, user, locale), "text/html"); multipart.addBodyPart(bodyPart); DataSource imageDs = new ByteArrayDataSource(LOGO_BYTES, "image/png"); @@ -103,11 +104,13 @@ public abstract class NotificationSetNotification implements MailNotification }); } - private String getMailContent(NotificationMailTemplate notificationMailTemplate, Locale locale) { + private String getMailContent(NotificationMailTemplate notificationMailTemplate, User user, Locale locale) { StringBuilder bodyContent = new StringBuilder(); if (notificationMailTemplate.getTitle() != null) { bodyContent.append("

").append(notificationMailTemplate.getTitle()).append("

"); } + String name = user.getFullName() == null || user.getFullName().isEmpty() ? user.getName() : user.getFullName(); + bodyContent.append("

").append(messages.get(locale, "salutation", name)).append("

"); bodyContent.append("

").append(notificationMailTemplate.getText()).append("

"); for (Pair link : notificationMailTemplate.getLabelsAndLinkUrls()) { bodyContent.append("
").append("