0
我无法配置Spring和Sendmail一起工作。Spring Boot Sendmail
弹簧侧:
的pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
application.properties
spring.mail.protocol=smtp
spring.mail.host=localhost
spring.mail.port=25
spring.mail.username=
spring.mail.password=
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=false
发送邮件代码(可与Gmail的罚款)
@Async
@Override
public void sendActivationEmail(String username, String activationToken) {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(username);
message.setSubject(EmailUtils.EMAIL_ACTIVATION_SUBJECT);
message.setText(String.format(EmailUtils.EMAIL_ACTIVATION_BODY, activationToken));
this.javaMailSender.send(message);
}
Linux方面:
的/ etc /邮件/访问
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
的/ etc /邮件/本地主机名
mydomain.com
的/ etc /邮件/的virtusertable
[email protected] noreply
(我有作为用户添加noreply)
我没有得到任何错误。没有日志。没有发送电子邮件。我如何配置它?
它解决了,但我切换回Gmail后。 10倍 –