Unable to send an email using SMTP (Getting javax.mail.MessagingException: Could not convert socket to TLS;)

前端 未结 11 1905
北恋
北恋 2020-12-10 12:04

I have written the following code for sending email using javamail API through SMTP as TLS as SSL is not supported but I ended up with the following exception. Please see my

11条回答
  •  猫巷女王i
    2020-12-10 12:28

    session.getProperties().put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.ssl.trust", "smtp.office365.com(site where your account is)");
    props.put("mail.smtp.starttls.enable", true);
    

    These codes should be able to start a ttls communication and get the mail service running.

    In addition to this the antivirus creates a firewall that stops the handshake from happening.

提交回复
热议问题