📅  最后修改于: 2022-03-11 14:52:15.903000             🧑  作者: Mango
// add this line mail.smtp.ssl.protocols=TLSv1.2; in properties
// in your Mail Implementation class
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.ssl.protocols","TLSv1.2");
//TO be more specific
Properties prop = new Properties();
prop.setProperty("mail.smtp.auth", "true");
prop.setProperty("mail.smtp.starttls.enable", "true");
prop.setProperty("mail.smtp.ssl.protocols", "TLSv1.2"); // New Line
prop.setProperty("mail.smtp.ssl.trust", mailUri.getHost());
mailSender.setJavaMailProperties(prop);