fix sending email to an unauthenticated smtp server

This commit is contained in:
Benjamin Gamard 2017-11-17 23:47:53 +01:00
parent 4cf1f29e0a
commit fdb95484c1
3 changed files with 10 additions and 5 deletions

View File

@ -75,10 +75,13 @@ public class EmailUtil {
email.setCharset("UTF-8");
email.setHostName(ConfigUtil.getConfigStringValue(ConfigType.SMTP_HOSTNAME));
email.setSmtpPort(ConfigUtil.getConfigIntegerValue(ConfigType.SMTP_PORT));
email.setAuthentication(ConfigUtil.getConfigStringValue(ConfigType.SMTP_USERNAME),
ConfigUtil.getConfigStringValue(ConfigType.SMTP_PASSWORD));
email.addTo(recipientUser.getEmail(), recipientUser.getUsername());
ConfigDao configDao = new ConfigDao();
Config usernameConfig = configDao.getById(ConfigType.SMTP_USERNAME);
Config passwordConfig = configDao.getById(ConfigType.SMTP_PASSWORD);
if (usernameConfig != null && passwordConfig != null) {
email.setAuthentication(usernameConfig.getValue(), passwordConfig.getValue());
}
email.addTo(recipientUser.getEmail(), recipientUser.getUsername());
Config themeConfig = configDao.getById(ConfigType.THEME);
String appName = "Sismics Docs";
if (themeConfig != null) {

View File

@ -2,4 +2,5 @@ email.template.password_recovery.subject=Please reset your password
email.template.password_recovery.hello=Hello {0}.
email.template.password_recovery.instruction1=We have received a request to reset your password.<br/>If you did not request help, then feel free to ignore this email.
email.template.password_recovery.instruction2=To reset your password, please visit the link below:
email.template.password_recovery.click_here=Click here to reset your password
email.template.password_recovery.click_here=Click here to reset your password
email.no_html.error=Your email client does not support HTML messages

View File

@ -2,4 +2,5 @@ email.template.password_recovery.subject=R
email.template.password_recovery.hello=Bonjour {0}.
email.template.password_recovery.instruction1=Nous avons reçu une demande de réinitialisation de mot de passe.<br/>Si vous n''avez rien demandé, vous pouvez ignorer cet mail.
email.template.password_recovery.instruction2=Pour réinitialiser votre mot de passe, cliquez sur le lien ci-dessous :
email.template.password_recovery.click_here=Cliquez ici pour réinitialiser votre mot de passe.
email.template.password_recovery.click_here=Cliquez ici pour réinitialiser votre mot de passe.
email.no_html.error=Votre client mail ne supporte pas les messages au format HTML