List of usage examples for org.springframework.mail.javamail JavaMailSenderImpl getJavaMailProperties
public Properties getJavaMailProperties()
From source file:org.apache.syncope.core.provisioning.java.job.notification.NotificationJobDelegate.java
@Override public void afterPropertiesSet() throws Exception { if (mailSender instanceof JavaMailSenderImpl) { JavaMailSenderImpl javaMailSender = (JavaMailSenderImpl) mailSender; Properties javaMailProperties = javaMailSender.getJavaMailProperties(); Properties props = PropertyUtils.read(Encryptor.class, "mail.properties", "conf.directory").getLeft(); for (Enumeration<?> e = props.propertyNames(); e.hasMoreElements();) { String prop = (String) e.nextElement(); if (prop.startsWith("mail.smtp.")) { javaMailProperties.setProperty(prop, props.getProperty(prop)); }// w w w. ja va 2 s . co m } if (StringUtils.isNotBlank(javaMailSender.getUsername())) { javaMailProperties.setProperty("mail.smtp.auth", "true"); } javaMailSender.setJavaMailProperties(javaMailProperties); String mailDebug = props.getProperty("mail.debug", "false"); if (BooleanUtils.toBoolean(mailDebug)) { Session session = javaMailSender.getSession(); session.setDebug(true); session.setDebugOut(new PrintStream(new LogOutputStream(LOG))); } } }