1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-12 17:26:13 +00: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:
Evil McJerkface
2020-11-19 03:15:40 -06:00
committed by GitHub
parent 5b2833350c
commit b6ec5e108b

View File

@@ -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