Spring Boot application integrates multiple mail
quickly.
- Import dependencies
<dependency>
<groupId>com.yookue.springstarter</groupId>
<artifactId>multiple-mail-spring-boot-starter</artifactId>
<version>LATEST</version>
</dependency>
By default, this starter will auto take effect, you can turn it off by
spring.multiple-mail.enabled = false
- Configure Spring Boot
application.yml
with prefixspring.multiple-mail
spring:
multiple-mail:
primary:
host: '192.168.0.1'
port: 25
username: 'foo1'
password: 'bar1'
properties:
secondary:
host: '192.168.0.2'
port: 25
username: 'foo2'
password: 'bar2'
properties:
tertiary:
quaternary:
quinary:
senary:
This starter supports 6
JavaMailSenderImpl
at most.
- Configure your beans with the following bean by
@Autowired
/@Resource
annotation, combined with@Qualifier
annotation (takeprimary
as an example)
Bean Type | Qualifier |
---|---|
JavaMailSenderImpl | PrimaryMailSenderConfiguration.MAIL_SENDER |
- jdk 17+
This project is under the Apache License 2.0
See the NOTICE.txt
file for required notices and attributions.
You like this package? Then donate to Yookue to support the development.
- Yookue: https://yookue.com