org.springframework.mail.MailSender Java Examples

The following examples show how to use org.springframework.mail.MailSender. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MailSenderAutoConfigurationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Test
public void mailSender_MailSenderWithJava_configuresJavaMailSender() {
	this.contextRunner.run(context -> {
		assertThat(context.getBean(MailSender.class)).isNotNull();
		assertThat(context.getBean(JavaMailSender.class)).isNotNull();
		assertThat(context.getBean(JavaMailSender.class))
				.isSameAs(context.getBean(MailSender.class));
	});
}
 
Example #2
Source File: FeedbackController.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
FeedbackController(
    UserService userService,
    AppSettings appSettings,
    ReCaptchaService reCaptchaService,
    MailSender mailSender,
    MessageSource messageSource) {
  super(ID, URI);
  this.userService = requireNonNull(userService);
  this.appSettings = requireNonNull(appSettings);
  this.reCaptchaService = requireNonNull(reCaptchaService);
  this.mailSender = requireNonNull(mailSender);
  this.messageSource = requireNonNull(messageSource);
}
 
Example #3
Source File: MailSenderAutoConfigurationTest.java    From spring-cloud-aws with Apache License 2.0 5 votes vote down vote up
@Test
void mailIsDisabled() {
	this.contextRunner.withPropertyValues("cloud.aws.mail.enabled:false")
			.run(context -> {
				assertThat(context).doesNotHaveBean(MailSender.class);
				assertThat(context).doesNotHaveBean(JavaMailSender.class);
			});
}
 
Example #4
Source File: ImportRunService.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
ImportRunService(
    DataService dataService,
    MailSender mailSender,
    UserService userService,
    ContextMessageSource contextMessageSource,
    ImportRunFactory importRunFactory) {
  this.dataService = requireNonNull(dataService);
  this.mailSender = requireNonNull(mailSender);
  this.userService = requireNonNull(userService);
  this.contextMessageSource = requireNonNull(contextMessageSource);
  this.importRunFactory = requireNonNull(importRunFactory);
}
 
Example #5
Source File: SmtpServiceConnectorCreatorTest.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
@Test
public void cloudMailSenderCreation() throws Exception {
	SmtpServiceInfo serviceInfo = createServiceInfo();

	MailSender dataSource = testCreator.create(serviceInfo, null);

	assertConnectorProperties(serviceInfo, dataSource);
}
 
Example #6
Source File: AccountServiceImpl.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
AccountServiceImpl(
    DataService dataService,
    MailSender mailSender,
    UserService userService,
    AppSettings appSettings,
    AuthenticationSettings authenticationSettings,
    IdGenerator idGenerator) {
  this.dataService = requireNonNull(dataService);
  this.mailSender = requireNonNull(mailSender);
  this.userService = requireNonNull(userService);
  this.appSettings = requireNonNull(appSettings);
  this.authenticationSettings = requireNonNull(authenticationSettings);
  this.idGenerator = requireNonNull(idGenerator);
}
 
Example #7
Source File: MailConfig.java    From phoenix.webui.framework with Apache License 2.0 5 votes vote down vote up
@Bean(autowire = Autowire.BY_TYPE)
public MailSender mailBean()
{
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    mailSender.setHost(mailHost);
    mailSender.setUsername(mailUserName);
    mailSender.setPassword(mailPassword);
    setUpMailPro(mailSender);

    return mailSender;
}
 
Example #8
Source File: PasswordResetterImpl.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
PasswordResetterImpl(
    PasswordResetTokenRepository passwordResetTokenRepository,
    UserService userService,
    MailSender mailSender,
    AppSettings appSettings) {
  this.passwordResetTokenService = requireNonNull(passwordResetTokenRepository);
  this.userService = requireNonNull(userService);
  this.mailSender = requireNonNull(mailSender);
  this.appSettings = requireNonNull(appSettings);
}
 
Example #9
Source File: SmtpServiceConnectorCreatorTest.java    From spring-cloud-connectors with Apache License 2.0 5 votes vote down vote up
private void assertConnectorProperties(SmtpServiceInfo serviceInfo, MailSender connector) {
	assertNotNull(connector);
	
	JavaMailSenderImpl javaMailSender = (JavaMailSenderImpl) connector;
	assertEquals(serviceInfo.getHost(), javaMailSender.getHost());
	assertEquals(serviceInfo.getPort(), javaMailSender.getPort());
	assertEquals(serviceInfo.getUserName(), javaMailSender.getUsername());
	assertEquals(serviceInfo.getPassword(), javaMailSender.getPassword());
}
 
Example #10
Source File: DefaultEmailIdentifierNotificationStrategy.java    From openregistry with Apache License 2.0 5 votes vote down vote up
@Inject
/**
 * @param mailSender - the mail sender
 * @param messageSource - the source of text needed for email generation
 */
public DefaultEmailIdentifierNotificationStrategy(MailSender mailSender,
		MessageSource messageSource) {
    this.mailSender = mailSender;
    this.messageSource = messageSource;
}
 
Example #11
Source File: IndexJobSchedulerTest.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
  return mailSender;
}
 
Example #12
Source File: MailSenderImpl.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
private MailSender createMailSender() {
  return mailSenderFactory.createMailSender(mailSettings);
}
 
Example #13
Source File: ProgressFactoryImpl.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
ProgressFactoryImpl(JobExecutionUpdater jobExecutionUpdater, MailSender mailSender) {
  this.jobExecutionUpdater = requireNonNull(jobExecutionUpdater);
  this.mailSender = requireNonNull(mailSender);
}
 
Example #14
Source File: ProgressImpl.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
ProgressImpl(JobExecution jobExecution, JobExecutionUpdater updater, MailSender mailSender) {
  this.jobExecution = requireNonNull(jobExecution);
  this.mailSender = requireNonNull(mailSender);
  this.updater = requireNonNull(updater);
}
 
Example #15
Source File: MailSenderAutoConfiguration.java    From spring-cloud-aws with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingClass("org.springframework.cloud.aws.mail.simplemail.SimpleEmailServiceJavaMailSender")
public MailSender simpleMailSender(
		AmazonSimpleEmailService amazonSimpleEmailService) {
	return new SimpleEmailServiceMailSender(amazonSimpleEmailService);
}
 
Example #16
Source File: AccountServiceImplTest.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
  return mock(MailSender.class);
}
 
Example #17
Source File: PlatformITConfig.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
public MailSender mailSender() {
  return mock(MailSender.class);
}
 
Example #18
Source File: FeedbackControllerTest.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
  return mock(MailSender.class);
}
 
Example #19
Source File: MailServiceConfiguration.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Bean
MailSenderBackend mailSenderBackend(MailSender mailSender) {
    return new SpringMailSenderBackend(mailSender);
}
 
Example #20
Source File: NotifyService.java    From dts-shop with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
	this.mailSender = mailSender;
}
 
Example #21
Source File: NotifyService.java    From mall with MIT License 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
    this.mailSender = mailSender;
}
 
Example #22
Source File: CenterConfig.java    From earth-frost with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnProperty(value = "frost.notifier.mail.enabled", havingValue = "true", matchIfMissing = true)
@ConfigurationProperties("frost.notifier.mail")
public MailEventNotifier mailEventNotifier(MailSender sender) {
  return new MailEventNotifier(sender);
}
 
Example #23
Source File: NotifyService.java    From litemall with MIT License 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
    this.mailSender = mailSender;
}
 
Example #24
Source File: EmailSupport.java    From OpenCue with Apache License 2.0 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
    this.mailSender = mailSender;
}
 
Example #25
Source File: SendOrderConfirmationEmailAdvice.java    From jpetstore-kubernetes with Apache License 2.0 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
	this.mailSender = mailSender;
}
 
Example #26
Source File: MailServiceTest.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
    return new TestMailSender();
}
 
Example #27
Source File: SpringMailSenderBackend.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Autowired
public SpringMailSenderBackend(MailSender mailSender) {
    this.mailSender = mailSender;
}
 
Example #28
Source File: NotifyService.java    From BigDataPlatform with GNU General Public License v3.0 4 votes vote down vote up
public void setMailSender(MailSender mailSender) {
    this.mailSender = mailSender;
}
 
Example #29
Source File: FailureMailSenderTest.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
    return mock(MailSender.class);
}
 
Example #30
Source File: TemplateTest.java    From haven-platform with Apache License 2.0 4 votes vote down vote up
@Bean
MailSender mailSender() {
    return mock(MailSender.class);
}