I know I can use the following properties to automatically create a JavaMailSender bean:
spring.mail.host=hostname
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
However, how can I define these properties to create two JavaMailSender beans so I can send emails from different SMTP servers?
I tried defining the following properties:
# Properties for sender 1
spring.mail.host=hostname
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password
# Properties for sender 2
spring.mail.host1=hostname2
spring.mail.port1=587
spring.mail.username1=username2
spring.mail.password1=password2
However, this does not work as I expected, so how can I create two JavaMailSender beans using Spring boot?