I am trying to send mail using java mail api. But exception is come to me with above message.
Could not connect to SMTP host: {remote-server}, port: {port}, response: -1
What`s mean "response : -1"
I can`t found this code in api manual.
A response code of -1
means that JavaMail failed to get a valid response code from the SMTP server. You can view the relevant source here .
Most likely, you either have your properties set incorrectly or you have a networking issue such as a firewall blocking the connection.
You might try enabling debug mode ( session.setDebug(true)
). Please post your code if you need further help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.