| | |
| | |
|
| | | final String mailUser = settings.getString(Keys.mail.username, null);
|
| | | final String mailPassword = settings.getString(Keys.mail.password, null);
|
| | | final boolean smtps = settings.getBoolean(Keys.mail.smtps, false);
|
| | | boolean authenticate = !StringUtils.isEmpty(mailUser) && !StringUtils.isEmpty(mailPassword);
|
| | | String server = settings.getString(Keys.mail.server, "");
|
| | | if (StringUtils.isEmpty(server)) {
|
| | |
| | | props.setProperty("mail.smtp.auth", String.valueOf(authenticate));
|
| | | props.setProperty("mail.smtp.auths", String.valueOf(authenticate));
|
| | |
|
| | | if (isGMail) {
|
| | | if (isGMail || smtps) {
|
| | | props.setProperty("mail.smtp.starttls.enable", "true");
|
| | | props.put("mail.smtp.socketFactory.port", String.valueOf(port));
|
| | | props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
|
| | |
| | | return session != null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Creates a message for the administrators.
|
| | | * |
| | | * @returna message
|
| | | */
|
| | | public Message createMessageForAdministrators() {
|
| | | List<String> toAddresses = settings.getStrings(Keys.mail.adminAddresses);
|
| | | if (toAddresses.size() == 0) {
|
| | | logger.warn("Can not notify administrators because no email addresses are defined!");
|
| | | return null;
|
| | | }
|
| | | return createMessage(toAddresses);
|
| | | }
|
| | |
|
| | | /**
|
| | | * Create a message.
|