Class MailAutoConfiguration
java.lang.Object
com.netcetera.girders.autoconfigure.mail.MailAutoConfiguration
@AutoConfiguration
@ConditionalOnClass(GirdersMailSender.class)
@EnableConfigurationProperties({GirdersMailProperties.class,org.springframework.boot.autoconfigure.mail.MailProperties.class})
@ConditionalOnMissingBean(value=org.springframework.mail.javamail.JavaMailSenderImpl.class,
search=CURRENT)
@Conditional(com.netcetera.girders.autoconfigure.mail.MailAutoConfiguration.MailSenderCondition.class)
@AutoConfigureBefore(value={org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration.class,org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration.class},
name="org.springframework.boot.actuate.autoconfigure.mail.MailHealthContributorAutoConfiguration")
public class MailAutoConfiguration
extends Object
Spring Boot auto configuration for the mail feature.
-
Constructor Summary
ConstructorDescriptionMailAutoConfiguration
(org.springframework.boot.autoconfigure.mail.MailProperties mailProperties, org.springframework.beans.factory.ObjectProvider<jakarta.mail.Session> session, GirdersMailProperties girdersMailProperties, io.micrometer.core.instrument.MeterRegistry meterRegistry) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.mail.javamail.JavaMailSenderImpl
Provide the mail sender.
-
Constructor Details
-
MailAutoConfiguration
public MailAutoConfiguration(org.springframework.boot.autoconfigure.mail.MailProperties mailProperties, org.springframework.beans.factory.ObjectProvider<jakarta.mail.Session> session, GirdersMailProperties girdersMailProperties, @Autowired(required=false) io.micrometer.core.instrument.MeterRegistry meterRegistry) Constructor.- Parameters:
mailProperties
- Properties for the mail systemsession
- SessiongirdersMailProperties
- Additional properties for the Girders mail sendermeterRegistry
- Metering registry (optional)
-
-
Method Details
-
mailSender
@Bean public org.springframework.mail.javamail.JavaMailSenderImpl mailSender()Provide the mail sender.Note: Fixes a problem introduced with Javamail 1.4.1. If username and password are not null Javamail still tries to attempt to authenticate against the mail server if the server supports authentication.
The Girders default configuration for the 'mailSender' bean leaves those two properties unset which is interpreted by Spring as "" instead of null. Hence, Javamail would attempt to authenticate against the mail server with empty user/pw. Unfortunately, setting
mail.smtp.auth=false
(see docs) does not help as it is ignored by Javamail if user/pw are not null.- Returns:
- the mail sender
-