• 使用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/
    本文版权归作者和博客园共有,转载请在文章页面明显位置标明原文链接。
  • 相关阅读:
    SQL Server 数据库基础编程
    Spring整合DWR comet 实现无刷新 多人聊天室
    SQL Server 数据库安全
    【MongoDB for Java】Java操作MongoDB
    SQL Server 触发器
    使用Dom4j操作XML
    BlazeDS 整合 Flex HelloWorld 示例
    SQL Server 索引和视图
    JDOM 操作XML
    SQL Server 数据库设计
  • 原文地址:https://www.cnblogs.com/hiscode/p/spring-boot-gmail.html
  • Copyright © 2020-2023  润新知