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
193 views
in Technique[技术] by (71.8m points)

java - SimpleEmail works within IntelliJ fails from command line

Using org.apache.commons.mail.SimpleEmail to send an email from within a background application. This has been working for 8 months with no problems. On January 1st it started failing. The application is Scala (2.12.8) and Java (1.8) running on a Mac (macOS 10.15.7).

Sending the email to smtp.googlemail.com port 465 (also tried smtp.gmail.com).

Using IntelliJ as the IDE. If the application runs within IntelliJ, it still works perfectly, but if you create a Jar and run from the command line it fails every time. Running from a Jar using 'sudo' also fails.

So did some setting change at Google as of Jan 1? Why would it still work within the IDE - is there a context or certificate present within IntelliJ? A certificate needed for SSL?

Appreciate any suggestions!

-------- Addendum - all parameters to the send() method ---------

       Heading: FAILURE       --- my addition
            ID: (None)        --- my addition
            To: [email protected]
       Subject: Backup for JDCMacBook was 150.1M
       Message: For JDCMacBook, Drive: USBExtA, Backup 2021-01-08-103310 compared to 2021-01-08-053055 Adds: 3.3M  Changes: 142.3M Deletes: 4.4M 
SendIfPossible: true
       To Host: smtp.googlemail.com
       To Port: 465
     Auth User: [email protected]
      Auth Pwd: .... redacted ....
       Set SSL: true

------- Stack trace -----------

     Exception: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.googlemail.com:465


10:44:11.749  0:00.002 ERROR: org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)

10:44:11.749           ERROR: org.apache.commons.mail.Email.send(Email.java:1496)

10:44:11.749           ERROR: jdctm.Utils$.sendEMail(Utils.scala:547)

10:44:11.750  0:00.001 ERROR: jdctm.NotifyInfo.notify(Cache.scala:1036)

10:44:11.750           ERROR: jdctm.Cache$.notify(Cache.scala:722)

10:44:11.750           ERROR: jdctm.ExecuteTMUtil.run(Cache.scala:952)

10:44:11.750           ERROR: java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)

10:44:11.751  0:00.001 ERROR: java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)

10:44:11.751           ERROR: java.base/java.lang.Thread.run(Thread.java:831)

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

1 Reply

0 votes
by (71.8m points)

IntelliJ is using Java 8, had upgraded to Java 16 (early access) for some tests and that is what is used on the command line. Turned on SimpleEmail setDebug(true) and failing during the SSL handshake - No appropriate protocol (protocol is disabled or cipher suites are inappropriate) So some change in protocols/cipher suites between Java 8 and 16 (ea). WORKs under Java 15.0.1, FAILs under jdk16.ea.30.2130. Will revert to Java 8 for now, retest once Java 16 is released.


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

...