SpringBoot发送邮件(启动报错)

***************************
APPLICATION FAILED TO START
***************************

Description:

Field mailSender in aa.sms.service.impl.MailServiceImpl required a bean of type 'org.springframework.mail.javamail.JavaMailSender' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'org.springframework.mail.javamail.JavaMailSender' in your configuration.


Process finished with exit code 1

原因:配置项未正确配置

# e-mail
spring:
  mail:
    protocol: smtps
    host: smtp.163.com
    username: 你的邮箱地址
    password: 密码(处理过的)
    port: 465
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          socketFactoryClass: javax.net.ssl.SSLSocketFactory
        debug: true

你可能感兴趣的:(spring,boot,java,spring)