aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server-common
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2022-02-15 17:50:19 +0100
committersonartech <sonartech@sonarsource.com>2022-02-17 20:03:22 +0000
commit4b4066f0f75a4d45ebdb588d61ceb913e4b05bd8 (patch)
tree5c736f7c47b7f04c447438640b904fd2c7ca7b29 /server/sonar-server-common
parentbe46f86d1051437f6de475881bd95f7a31835539 (diff)
downloadsonarqube-4b4066f0f75a4d45ebdb588d61ceb913e4b05bd8.tar.gz
sonarqube-4b4066f0f75a4d45ebdb588d61ceb913e4b05bd8.zip
SONAR-11767 add base url to test emails
Diffstat (limited to 'server/sonar-server-common')
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
index 2fbc97081b8..7494f673a36 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/notification/email/EmailNotificationChannel.java
@@ -91,6 +91,7 @@ public class EmailNotificationChannel extends NotificationChannel {
private static final String SUBJECT_DEFAULT = "Notification";
private static final String SMTP_HOST_NOT_CONFIGURED_DEBUG_MSG = "SMTP host was not configured - email will not be sent";
+ private static final String MAIL_SENT_FROM = "%sMail sent from: %s";
private final EmailSettings configuration;
private final EmailTemplate[] templates;
@@ -333,7 +334,7 @@ public class EmailNotificationChannel extends NotificationChannel {
EmailMessage emailMessage = new EmailMessage();
emailMessage.setTo(toAddress);
emailMessage.setSubject(subject);
- emailMessage.setPlainTextMessage(message);
+ emailMessage.setPlainTextMessage(message + getServerBaseUrlFooter());
send(emailMessage);
} catch (EmailException e) {
LOG.debug("Fail to send test email to {}: {}", toAddress, e);
@@ -341,4 +342,8 @@ public class EmailNotificationChannel extends NotificationChannel {
}
}
+ private String getServerBaseUrlFooter() {
+ return String.format(MAIL_SENT_FROM, "\n\n", configuration.getServerBaseURL());
+ }
+
}