实际上,我们的产品中确实有一些通知代码,如果有的话,它们会使用TLS发送邮件。
您将需要设置Java Mail属性。您仅需要一个TLS,但如果您的SMTP服务器使用SSL,则可能需要SSL。
Properties props = new Properties();props.put("mail.smtp.starttls.enable","true");props.put("mail.smtp.auth", "true"); // If you need to authenticate// Use the following if you need SSLprops.put("mail.smtp.socketFactory.port", d_port);props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");props.put("mail.smtp.socketFactory.fallback", "false");然后,您可以将其传递给JavaMail Session或任何其他会话实例化器,例如
Session.getDefaultInstance(props)。



