使用 JSSEProvider 和 javax.mail.Authenticator 发送电子邮件

Sending E-mail using JSSEProvider and javax.mail.Authenticator

出于某种原因,当我尝试使用此 example 发送电子邮件时,我收到一封来自 google 的电子邮件,内容为:登录尝试被阻止...有人试图从不符合现代安全标准的应用程序登录。 有人知道原因是什么吗? 谢谢

您需要enable less secure apps or you need to use OAuth authentication