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

    Constructors
    Constructor
    Description
    MailAutoConfiguration(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 Type
    Method
    Description
    org.springframework.mail.javamail.JavaMailSenderImpl
    Provide the mail sender.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 system
      session - Session
      girdersMailProperties - Additional properties for the Girders mail sender
      meterRegistry - 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