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;
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);
}
}
+ private String getServerBaseUrlFooter() {
+ return String.format(MAIL_SENT_FROM, "\n\n", configuration.getServerBaseURL());
+ }
+
}
assertThat(email.getHeader("From", ",")).isEqualTo("SonarQube from NoWhere <server@nowhere>");
assertThat(email.getHeader("To", null)).isEqualTo("<user@nowhere>");
assertThat(email.getHeader("Subject", null)).isEqualTo("[SONARQUBE] Test Message from SonarQube");
- assertThat((String) email.getContent()).startsWith("This is a test message from SonarQube.");
+ assertThat((String) email.getContent()).startsWith("This is a test message from SonarQube.\r\n\r\nMail sent from: http://nemo.sonarsource.org");
}
@Test