Source:
private static Properties getProperties(PropertiesProvider provider) { Properties properties = new Properties(); String host = provider.getString("mail.smtp.host"); if (host != null) { properties.put("mail.transport.protocol", provider.getString("mail.transport.protocol", "smtp")); properties.put("mail.smtp.host", host); properties.put("mail.smtp.port", String.valueOf(provider.getInteger("mail.smtp.port", 25))); Boolean starttlsEnable = provider.getBoolean("mail.smtp.starttls.enable"); if (starttlsEnable != null) { properties.put("mail.smtp.starttls.enable", starttlsEnable); } Boolean starttlsRequired = provider.getBoolean("mail.smtp.starttls.required"); if (starttlsRequired != null) { properties.put("mail.smtp.starttls.required", starttlsRequired); } Boolean sslEnable = provider.getBoolean("mail.smtp.ssl.enable"); if (sslEnable != null) { properties.put("mail.smtp.ssl.enable", sslEnable); } String sslTrust = provider.getString("mail.smtp.ssl.trust"); if (sslTrust != null) { properties.put("mail.smtp.ssl.trust", sslTrust); } String sslProtocols = provider.getString("mail.smtp.ssl.protocols"); if (sslProtocols != null) { properties.put("mail.smtp.ssl.protocols", sslProtocols); } String username = provider.getString("mail.smtp.username"); if (username != null) { properties.put("mail.smtp.username", username); } String password = provider.getString("mail.smtp.password"); if (password != null) { properties.put("mail.smtp.password", password); } String from = provider.getString("mail.smtp.from"); if (from != null) { properties.put("mail.smtp.from", from); } } return properties; }

Target:
private static Properties getProperties(PropertiesProvider provider) { Properties properties = new Properties(); String host = provider.getString("mail.smtp.host"); if (host != null) { properties.put("mail.transport.protocol", provider.getString("mail.transport.protocol", "smtp")); properties.put("mail.smtp.host", host); properties.put("mail.smtp.port", String.valueOf(provider.getInteger("mail.smtp.port", 25))); Boolean starttlsEnable = provider.getBoolean("mail.smtp.starttls.enable"); if (starttlsEnable != null) { properties.put("mail.smtp.starttls.enable", String.valueOf(starttlsEnable)); } Boolean starttlsRequired = provider.getBoolean("mail.smtp.starttls.required"); if (starttlsRequired != null) { properties.put("mail.smtp.starttls.required", String.valueOf(starttlsRequired)); } Boolean sslEnable = provider.getBoolean("mail.smtp.ssl.enable"); if (sslEnable != null) { properties.put("mail.smtp.ssl.enable", String.valueOf(sslEnable)); } String sslTrust = provider.getString("mail.smtp.ssl.trust"); if (sslTrust != null) { properties.put("mail.smtp.ssl.trust", sslTrust); } String sslProtocols = provider.getString("mail.smtp.ssl.protocols"); if (sslProtocols != null) { properties.put("mail.smtp.ssl.protocols", sslProtocols); } String username = provider.getString("mail.smtp.username"); if (username != null) { properties.put("mail.smtp.username", username); } String password = provider.getString("mail.smtp.password"); if (password != null) { properties.put("mail.smtp.password", password); } String from = provider.getString("mail.smtp.from"); if (from != null) { properties.put("mail.smtp.from", from); } } return properties; }