1.bug描述
Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.SocketException: Permission denied: connect
2.解决方案:
通过google,找准关键词【Could not connect to SMTP host: java.net.SocketException: Permission denied: connect】进行搜索。
本bug,就是 eclipse设置禁用IPv6:-Djava.net.preferIPv4Stack=true 得以解决。
3.心得
如果确定代码没有问题,就是环境的问题。