Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

spring boot - JavaMail does not work: will not send email (Exception reading response. Cause: java.net.SocketTimeoutException: Read timed out)

For some reason I've yet to figure out, I have a SpringBoot application that works perfectly on an older iMac (MacOS 13), but that same Tomcat application using JavaMail will not work, that is, it won't send the email under Mac OS 11.1 and Java 11.

The Exception is: Exception reading response Cause: java.net.SocketTimeoutException: Read timed out

I've done these tests:

  1. Used the exact same Tomcat (mac) folder on the 11.1 machine. This Tomcat folder is the one that works perfectly sending email on the older iMac. Does not work under Mac 11.1.

  2. Experimented with different Java versions. 8, 11, both Corretto, Oracle.

  3. Made sure no Firewall rule was interfering.

  4. Used VPN and no VPN and even VPN with different ports.

  5. Went into the Mac's security settings to see if there was something there I had missed. Network settings, privacy settings, turned off Mac firewall, etc.

  6. Noted that another service method that makes a connection to Twitter does work on the 11.1 Mac machine. So external connections do work, just not JavaMail.

  7. I stepped through the service code on the Mac with 11.1 and it's all OK until the Transport.send() method. That doesn't work and it times out there.

  8. Tried to use Charles proxy to see if that would help.

It seems to be something really odd with JavaMail.


The only thing I haven't been able to easily change on the new computer is the OS version itself (11.1).

And, I created a AWS instance, with same Tomcat version (9), copied the same SpringBoot app to it and, just like the older iMac, it worked! Email was sent.

I don't have a virus program installed. I had BitDefender, but it had so many bugs, I had to remove it.


So it seems the code is OK (works on older Mac and AWS instance) and there is something really weird going on with the 11.1 Mac OS. At least, that's my assumption based on an entire day trying to figure this out...

Would appreciate any and all suggestions.

Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...