java 发送 smtp.office365.com 验证不成功

匿名
2025-06-04T14:11:39+00:00

第一 我已经开启微软账号的双重验证 第二 已经启用应用密码 以下是我的配置 spring:   mail:     default-encoding: UTF-8     # 微软的邮箱是不用设置smtps的,是使用默认的smtp     protocol: smtp     # smtp-mail.outlook.com     host: smtp-mail.outlook.com     # 587     port: 587     username: ******@outlook.com     # 开启了MFA多重认证的,密码为应用密码,如需使用账号登录密码,则需要关闭多重认证     password: 我的应用密码     # 由于Office365邮件发送启用了STARTTLS的加密验证方式,所以需要通过spring.mail.properties的自定义属性来进行加密信息的相关配置。     properties:       mail:           smtp:             auth: true             # 仅设置该项开启STARTTLS             starttls:               enable: true               required: true #        imap: #          ssl: #            # 开启加密 好像是 qq邮箱独有 #            enable: true #            required: true         # 开启邮件发送debug           debug: true

最后报错 org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 5.7.139 Authentication unsuccessful, basic authentication is disabled. [SI1PR02CA0028.apcprd02.prod.outlook.com 2025-06-04T14:09:27.699Z 08DDA15C68020071]

我有注意到, Outlook.com 需要使用新式身份验证/OAuth2 请问 这两种验证 要怎么实现呢。
Outlook | Windows | 经典 Outlook for Windows | 家庭版

锁定的问题。 此问题已从 Microsoft 支持社区迁移。 你可投票决定它是否有用,但不能添加评论或回复,也不能关注问题。

0 个注释 无注释

问题作者接受的答案

  1. 匿名
    2025-06-04T14:47:36+00:00

    报错很明确,你也清楚症结所在了。basic authentication is disabled. 需要改用oauth2.0验证身份。

    适配改造非一句话能说清楚。建议参考MS Learn官网文档。下面的Outlook经验总结里,也有提供概括说明,以及几个官网文章的网址。仅供参考。

    此答案是否有帮助?

    1 个人认为此答案很有帮助。
    0 个注释 无注释

2 个其他答案

排序依据: 非常有帮助
  1. 匿名
    2025-06-04T14:34:39+00:00

    我也登录不上,可以帮助我吗

    此答案是否有帮助?

    0 个注释 无注释
  2. 匿名
    2025-06-04T14:23:57+00:00

    这里也不能注册了

    此答案是否有帮助?

    0 个注释 无注释