Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1

后端 未结 5 1154
一个人的身影
一个人的身影 2020-12-03 17:03

while sending mail I am getting this error

java.lang.RuntimeException: javax.mail.SendFailedException: Sending failed; nested exception is: cla

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 17:46

    Port 465 is for "smtp over SSL".

    http://javamail.kenai.com/nonav/javadocs/com/sun/mail/smtp/package-summary.html

    [...] For example, use
        props.put("mail.smtp.port", "888");
    to set the mail.smtp.port property, which is of type int.
    
    Note that if you're using the "smtps" protocol to access SMTP over SSL, 
    all the properties would be named "mail.smtps.*"
    

提交回复
热议问题