mirror of
https://github.com/sismics/docs.git
synced 2024-12-22 11:23:48 +01:00
Added support for TLS & STARTTLS for SMTP connections. If port 465 is configured, TLS will be assumed. If port 587 is used, STARTTLS is assumed. (#478)
Closes #353: Added support for TLS & STARTTLS for SMTP connections
This commit is contained in:
parent
5b2833350c
commit
b6ec5e108b
@ -99,11 +99,16 @@ public class EmailUtil {
|
||||
}
|
||||
|
||||
// Port
|
||||
int port = ConfigUtil.getConfigIntegerValue(ConfigType.SMTP_PORT);
|
||||
String envPort = System.getenv(Constants.SMTP_PORT_ENV);
|
||||
if (envPort == null) {
|
||||
email.setSmtpPort(ConfigUtil.getConfigIntegerValue(ConfigType.SMTP_PORT));
|
||||
} else {
|
||||
email.setSmtpPort(Integer.valueOf(envPort));
|
||||
if (envPort != null) {
|
||||
port = Integer.valueOf(envPort);
|
||||
}
|
||||
email.setSmtpPort(port);
|
||||
if (port == 465) {
|
||||
email.setSSLOnConnect(true);
|
||||
} else if (port == 587) {
|
||||
email.setStartTLSRequired(true);
|
||||
}
|
||||
|
||||
// Username and password
|
||||
|
Loading…
Reference in New Issue
Block a user