use of org.springframework.mail.javamail.JavaMailSenderImpl in project netxms by netxms.
the class AppContextConfig method javaMailSender.
@Bean
public JavaMailSender javaMailSender() {
JavaMailSenderImpl sender = new JavaMailSenderImpl();
sender.setHost(settings.getSmtpServer());
return sender;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project commons by craftercms.
the class EmailFactoryImplTest method createMailSender.
private JavaMailSenderImpl createMailSender() {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost("localhost");
mailSender.setPort(25);
mailSender.setProtocol("smtp");
mailSender.setDefaultEncoding(ENCODING);
return mailSender;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project molgenis by molgenis.
the class JavaMailSenderFactoryTest method testCreateMailSenderWithSpecifiedProperties.
@Test
public void testCreateMailSenderWithSpecifiedProperties() {
final Properties javaMailProps = new Properties();
// specify
javaMailProps.put("mail.debug", "true");
// override
javaMailProps.put("mail.smtp.starttls.enable", "false");
when(mailSettings.getJavaMailProperties()).thenReturn(javaMailProps);
JavaMailSenderImpl actual = javaMailSenderFactory.createMailSender(mailSettings);
assertEquals(actual.getHost(), "host");
assertEquals(actual.getPort(), 1234);
assertEquals(actual.getUsername(), "username");
assertEquals(actual.getPassword(), "password");
assertEquals(actual.getDefaultEncoding(), "UTF-8");
final Properties actualProperties = actual.getJavaMailProperties();
assertEquals(actualProperties.getProperty("mail.smtp.starttls.enable"), "false");
assertEquals(actualProperties.getProperty("mail.smtp.quitwait"), "false");
assertEquals(actualProperties.getProperty("mail.smtp.auth"), "true");
assertEquals(actualProperties.getProperty("mail.debug"), "true");
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project cloudbreak by hortonworks.
the class MailSenderConfig method mailSender.
@Bean
public JavaMailSender mailSender() {
JavaMailSender mailSender;
if (isMailSendingConfigured()) {
mailSender = new JavaMailSenderImpl();
((JavaMailSenderImpl) mailSender).setHost(host);
((JavaMailSenderImpl) mailSender).setPort(port);
if (!StringUtils.isEmpty(userName)) {
((JavaMailSenderImpl) mailSender).setUsername(userName);
}
if (!StringUtils.isEmpty(password)) {
((JavaMailSenderImpl) mailSender).setPassword(password);
}
((JavaMailSenderImpl) mailSender).setJavaMailProperties(getJavaMailProperties());
} else {
mailSender = new DummyEmailSender();
}
return mailSender;
}
use of org.springframework.mail.javamail.JavaMailSenderImpl in project spring-cloud-connectors by spring-cloud.
the class MailSenderCreator method create.
@Override
public JavaMailSender create(SmtpServiceInfo serviceInfo, ServiceConnectorConfig config) {
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
mailSender.setHost(serviceInfo.getHost());
mailSender.setPort(serviceInfo.getPort());
mailSender.setUsername(serviceInfo.getUserName());
mailSender.setPassword(serviceInfo.getPassword());
return mailSender;
}
Aggregations