diff --git a/src/main/java/sirius/web/mails/SendMailTask.java b/src/main/java/sirius/web/mails/SendMailTask.java index 163c0b982..8f937658a 100644 --- a/src/main/java/sirius/web/mails/SendMailTask.java +++ b/src/main/java/sirius/web/mails/SendMailTask.java @@ -33,6 +33,7 @@ import sirius.kernel.di.std.Part; import sirius.kernel.di.std.Parts; import sirius.kernel.health.Exceptions; +import sirius.web.security.UserContext; import java.io.File; import java.io.UnsupportedEncodingException; @@ -504,7 +505,10 @@ protected PasswordAuthentication getPasswordAuthentication() { protected Transport getSMTPTransport(Session session, SMTPConfiguration config) { try { Transport transport = session.getTransport(); - transport.connect(config.getMailHost(), config.getMailUser(), config.getMailPassword()); + String password = UserContext.getSettings().get("mail.useTransportAuthentication").asBoolean() ? + config.getMailPassword() : + null; + transport.connect(config.getMailHost(), config.getMailUser(), password); return transport; } catch (Exception e) { throw Exceptions.handle() diff --git a/src/main/resources/scope-conf/mail.conf b/src/main/resources/scope-conf/mail.conf index e2d2ed82f..f5f3c29dc 100644 --- a/src/main/resources/scope-conf/mail.conf +++ b/src/main/resources/scope-conf/mail.conf @@ -31,4 +31,7 @@ mail { # Whether E-Mail addresses should be encoded with punycode/IDN for e.g. äöüß in international mails usePunycode = false + + # Whether the mail server requires early authentication + useTransportAuthentication = false }