Revision 61749
Added by Konstantina Galouni about 3 years ago
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/configuration/properties/MailConfig.java | ||
---|---|---|
10 | 10 |
private String from; |
11 | 11 |
private String username; |
12 | 12 |
private String password; |
13 |
private String sslProtocols; |
|
13 | 14 |
|
14 | 15 |
public void setHost(String host) { |
15 | 16 |
this.host = host; |
... | ... | |
35 | 36 |
this.password = password; |
36 | 37 |
} |
37 | 38 |
|
39 |
public void setSslProtocols(String sslProtocols) { |
|
40 |
this.sslProtocols = sslProtocols; |
|
41 |
} |
|
42 |
|
|
38 | 43 |
public String getHost() { |
39 | 44 |
return host; |
40 | 45 |
} |
... | ... | |
58 | 63 |
public String getPassword() { |
59 | 64 |
return password; |
60 | 65 |
} |
66 |
|
|
67 |
public String getSslProtocols() { |
|
68 |
return sslProtocols; |
|
69 |
} |
|
61 | 70 |
} |
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/controllers/AdminToolsLibraryCheckDeployController.java | ||
---|---|---|
40 | 40 |
public Map<String, String> checkEverything() { |
41 | 41 |
Map<String, String> response = new HashMap<>(); |
42 | 42 |
response.put("admintoolslibrary.mail.auth",mailConfig.getAuth()); |
43 |
response.put("admintoolslibrary.mail.sslProtocols",mailConfig.getSslProtocols()); |
|
43 | 44 |
response.put("admintoolslibrary.mail.from", mailConfig.getFrom()); |
44 | 45 |
response.put("admintoolslibrary.mail.host", mailConfig.getHost()); |
45 | 46 |
response.put("admintoolslibrary.mail.port", mailConfig.getPort()); |
modules/uoa-admin-tools-library/trunk/src/main/java/eu/dnetlib/uoaadmintoolslibrary/emailSender/EmailSender.java | ||
---|---|---|
30 | 30 |
properties.put("mail.smtp.port", mailConfig.getPort()); |
31 | 31 |
properties.put("mail.smtp.auth", mailConfig.getAuth()); //enable authentication |
32 | 32 |
properties.put("mail.smtp.starttls.enable", "true"); |
33 |
if(mailConfig.getHost().equals("smtp.gmail.com")) {
|
|
34 |
properties.put("mail.smtp.ssl.protocols", "TLSv1.2");
|
|
33 |
if(mailConfig.getSslProtocols() != null) {
|
|
34 |
properties.put("mail.smtp.ssl.protocols", mailConfig.getSslProtocols());
|
|
35 | 35 |
} |
36 | 36 |
logger.debug("Try to connect to mail sender with "+ mailConfig.getUsername()); |
37 | 37 |
Session session = Session.getInstance(properties, |
Also available in: Unified diff
[Trunk | Admin Tools Library]:
1. MailConfig.java: Added field "sslProtocols".
2. AdminToolsLibraryCheckDeployController.java: Expose property "admintoolslibrary.mail.sslProtocols".
3. EmailSender.java: Set "mail.smtp.ssl.protocols" with value from property "admintoolslibrary.mail.sslProtocols", if it is not null.