I'm not sure where you got those properties. The more common Spring Boot properties to configure can be found here:
http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
So you should probably be using spring.mail.port
. The properties available in the spring.mail
namespace are:
host
port
username
password
defaultEncoding (default: "UTF-8")
However, if you are creating your own JavaMailSender
, the property to set the SMTP port is mail.smtp.port
. I set up the JavaMailSender
as a bean like so:
@Value(value = "${mail.smtp.host}")
private String smtpHost;
@Value(value = "${mail.smtp.port}")
private String smtpPort;
@Bean
public JavaMailSender mailSender() {
JavaMailSenderImpl sender = new JavaMailSenderImpl();
Properties p = new Properties();
p.setProperty("mail.smtp.auth", "false");
p.setProperty("mail.smtp.host", smtpHost);
p.setProperty("mail.smtp.port", smtpPort);
sender.setJavaMailProperties(p);
return sender;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…