Customizable From header
Signed-off-by: Bernardus Jansen <bernardus@bajansen.nl>
This commit is contained in:
+9
@@ -45,6 +45,7 @@ public class AdvancedSettingsCommand {
|
||||
private String smtpPort;
|
||||
private String smtpUser;
|
||||
private String smtpPassword;
|
||||
private String smtpFrom;
|
||||
|
||||
public String getDownloadLimit() {
|
||||
return downloadLimit;
|
||||
@@ -173,4 +174,12 @@ public class AdvancedSettingsCommand {
|
||||
public void setSmtpPassword(String smtpPassword) {
|
||||
this.smtpPassword = smtpPassword;
|
||||
}
|
||||
|
||||
public String getSmtpFrom() {
|
||||
return smtpFrom;
|
||||
}
|
||||
|
||||
public void setSmtpFrom(String smtpFrom) {
|
||||
this.smtpFrom = smtpFrom;
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -51,6 +51,7 @@ public class AdvancedSettingsController extends SimpleFormController {
|
||||
command.setSmtpEncryption(settingsService.getSmtpEncryption());
|
||||
command.setSmtpPort(settingsService.getSmtpPort());
|
||||
command.setSmtpUser(settingsService.getSmtpUser());
|
||||
command.setSmtpFrom(settingsService.getSmtpFrom());
|
||||
|
||||
return command;
|
||||
}
|
||||
@@ -83,6 +84,7 @@ public class AdvancedSettingsController extends SimpleFormController {
|
||||
settingsService.setSmtpEncryption(command.getSmtpEncryption());
|
||||
settingsService.setSmtpPort(command.getSmtpPort());
|
||||
settingsService.setSmtpUser(command.getSmtpUser());
|
||||
settingsService.setSmtpFrom(command.getSmtpFrom());
|
||||
|
||||
if (StringUtils.isNotEmpty(command.getSmtpPassword())) {
|
||||
settingsService.setSmtpPassword(command.getSmtpPassword());
|
||||
|
||||
@@ -168,7 +168,7 @@ public class MultiController extends MultiActionController {
|
||||
|
||||
try {
|
||||
Message message = new MimeMessage(session);
|
||||
message.setFrom(new InternetAddress("libresonic@libresonic.org"));
|
||||
message.setFrom(new InternetAddress(settingsService.getSmtpFrom()));
|
||||
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(email));
|
||||
message.setSubject("Libresonic Password");
|
||||
message.setText("Hi there!\n\n" +
|
||||
|
||||
@@ -149,6 +149,7 @@ public class SettingsService {
|
||||
private static final String KEY_SMTP_PORT = "SmtpPort";
|
||||
private static final String KEY_SMTP_USER = "SmtpUser";
|
||||
private static final String KEY_SMTP_PASSWORD = "SmtpPassword";
|
||||
private static final String KEY_SMTP_FROM = "SmtpFrom";
|
||||
|
||||
// Default values.
|
||||
private static final String DEFAULT_INDEX_STRING = "A B C D E F G H I J K L M N O P Q R S T U V W X-Z(XYZ)";
|
||||
@@ -223,6 +224,7 @@ public class SettingsService {
|
||||
private static final String DEFAULT_SMTP_PORT = "25";
|
||||
private static final String DEFAULT_SMTP_USER = null;
|
||||
private static final String DEFAULT_SMTP_PASSWORD = null;
|
||||
private static final String DEFAULT_SMTP_FROM = "libresonic@libresonic.org";
|
||||
|
||||
// Array of obsolete keys. Used to clean property file.
|
||||
private static final List<String> OBSOLETE_KEYS = Arrays.asList("PortForwardingPublicPort", "PortForwardingLocalPort",
|
||||
@@ -1508,4 +1510,12 @@ public class SettingsService {
|
||||
}
|
||||
properties.setProperty(KEY_SMTP_PASSWORD, smtpPassword);
|
||||
}
|
||||
|
||||
public String getSmtpFrom() {
|
||||
return properties.getProperty(KEY_SMTP_FROM, DEFAULT_SMTP_FROM);
|
||||
}
|
||||
|
||||
public void setSmtpFrom(String smtpFrom) {
|
||||
setString(KEY_SMTP_FROM, smtpFrom);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user