zoukankan      html  css  js  c++  java
  • 使用spring boot配置Gmail邮箱发送邮件

      最近项目有用到配置Gmail来发送通知邮件给客户,由于国内众所周知的原因,联调测试中遇到了一些问题,不过好在都一一解决了,现在做个记录,也给其他同仁做个参考。

    1. 相关配置:
    spring.mail.host=smtp.gmail.com
    spring.mail.username=xxx@gmail.com
    spring.mail.password=xxxxxxxxxxx
    spring.mail.properties.mail.smtp.port=465
    spring.mail.properties.mail.smtp.starttls.enable=true
    spring.mail.properties.mail.smtp.starttls.required=true
    spring.mail.properties.mail.smtp.ssl.enable=true
    spring.mail.properties.mail.smtp.auth=true
    spring.mail.properties.mail.smtp.connectiontimeout=6000
    spring.mail.properties.mail.smtp.timeout=5000
    spring.mail.properties.mail.smtp.writetimeout=5000
    spring.mail.properties.mail.debug=true #开启debug,可去掉
    spring.mail.default-encoding=utf-8

      2.谷歌配置

    需要在谷歌账号中开启两步验证,然后创建专用密码,使用专用密码来进行登录。

      3.酸酸乳配置

    如果是在开发环境本地调试,需要配置威批恩,我用的是酸酸乳,并且注意需要把酸酸乳的“服务器负载均衡”选项去掉,否则会导致发送时登录超时...这个问题我好不容易才发现解决了。

      4.eclipse等IDE配置

    需要在network connection配置中配置代理,使用酸酸乳的代理来连接网络。

    以上基本就是我所遇到的问题,欢迎大家补充。

    参考资料:https://support.google.com/mail/answer/7126229?visit_id=637110461608777618-2165677706&rd=2#cantsignin

  • 出处: http://www.cnblogs.com/hiscode/
    本文版权归作者和博客园共有,转载请在文章页面明显位置标明原文链接。
查看全文
  • 相关阅读:
    单例模式的四种方式
    创建者模式
    抽象工厂模式
    工厂方法模式
    【位运算符与逻辑运算符知识点】【二进制枚举子集】【just for 状压】
    【数学基础】【欧拉定理模板】【费马小定理】
    【练习赛补题】poj 3026 Borg Maze 【bfs+最小生成树】【坑~】
    【数学基础】【欧拉函数解析模板】【欧拉筛法实现求1~n】【求某个数字n】
    【 数学基础】【素数线性筛法--欧拉筛法模板】【普通筛法的优化】
    【练习赛2补题】poj 2325 Persistent Numbers 【高精度除法+贪心】
  • 原文地址:https://www.cnblogs.com/hiscode/p/spring-boot-gmail.html
  • Copyright © 2011-2022 走看看