spring boot整合邮件发送配置

发布时间:2022-06-18 20:04:57

常见错误:

Got bad greeting from SMTP host  这个需要配置ssl
553 Mail from must equal authorized user  我碰到的是设置的邮箱账号与代码中使用的账号不相同

spring boot 163配置

boot:
   admin:
     mail:
       to: ${spring.mail.username}
       from: ${spring.mail.username} 
  mail:
    host: smtp.163.com
    username: 邮箱账号
    password: 开启时的授权密码
    port: 994
    protocol: smtp
    default-encoding: UTF-8
    properties:
      mail:
       transport:
        protocol: smtp
       smtp:
        ssl:
         enable: true
        auth: true
        starttls:
         enable: true

spring boot 163企业邮箱配置

mail:
    host: smtp.ym.163.com
    username: xx@hudiepm.com
    password: password
    port: 587
    protocol: smtp
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          auth: true
          starttls:
            enable: true


Card image cap
APP STORE
Card image cap
应用宝
Card image cap
小米
Card image cap
华为