diff --git a/core-java-modules/core-java-networking-2/pom.xml b/core-java-modules/core-java-networking-2/pom.xml
index 77f23be97c..982f4fa346 100644
--- a/core-java-modules/core-java-networking-2/pom.xml
+++ b/core-java-modules/core-java-networking-2/pom.xml
@@ -25,15 +25,20 @@
${commons-lang3.version}
- javax.mail
- mail
- ${javax.mail.version}
+ org.eclipse.angus
+ angus-mail
+ ${angus.mail.version}
org.asynchttpclient
async-http-client
${async-http-client.version}
+
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+ ${jakarta.bind.version}
+
com.icegreen
greenmail
@@ -48,9 +53,10 @@
4.5.9
- 1.5.0-b01
+ 2.0.1
2.4.5
- 1.5.8
+ 2.3.3
+ 2.0.0-alpha-3
\ No newline at end of file
diff --git a/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/EmailService.java b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/EmailService.java
index 3e40cf53f7..b2d8e6b710 100644
--- a/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/EmailService.java
+++ b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/EmailService.java
@@ -1,19 +1,20 @@
package com.baeldung.mail;
-import javax.mail.Authenticator;
-import javax.mail.Message;
-import javax.mail.Multipart;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
import java.io.File;
import java.net.URI;
import java.util.Properties;
+import jakarta.mail.Authenticator;
+import jakarta.mail.Message;
+import jakarta.mail.Multipart;
+import jakarta.mail.PasswordAuthentication;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
+
public class EmailService {
private String username;
diff --git a/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java
index fbe8a54bbe..66e1372ac1 100644
--- a/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java
+++ b/core-java-modules/core-java-networking-2/src/main/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentService.java
@@ -1,21 +1,23 @@
package com.baeldung.mail.mailwithattachment;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.Properties;
+import jakarta.mail.Authenticator;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.PasswordAuthentication;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
+
public class MailWithAttachmentService {
private final String username;
@@ -37,7 +39,7 @@ public class MailWithAttachmentService {
props.put("mail.smtp.host", this.host);
props.put("mail.smtp.port", this.port);
- return Session.getInstance(props, new javax.mail.Authenticator() {
+ return Session.getInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
diff --git a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/download/FileDownloadIntegrationTest.java b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/download/FileDownloadIntegrationTest.java
index 8fe50efd69..a8670bb01e 100644
--- a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/download/FileDownloadIntegrationTest.java
+++ b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/download/FileDownloadIntegrationTest.java
@@ -1,10 +1,7 @@
package com.baeldung.download;
-import org.junit.After;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import static org.junit.Assert.assertTrue;
-import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
@@ -13,7 +10,11 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.concurrent.ExecutionException;
-import static org.junit.Assert.assertTrue;
+import javax.xml.bind.DatatypeConverter;
+
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
public class FileDownloadIntegrationTest {
diff --git a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/EmailServiceLiveTest.java b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/EmailServiceLiveTest.java
index cec4cfcb55..184df8428a 100644
--- a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/EmailServiceLiveTest.java
+++ b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/EmailServiceLiveTest.java
@@ -1,17 +1,19 @@
package com.baeldung.mail;
-import com.icegreen.greenmail.junit.GreenMailRule;
-import com.icegreen.greenmail.util.ServerSetupTest;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import java.io.IOException;
+import com.icegreen.greenmail.junit.GreenMailRule;
+import com.icegreen.greenmail.util.ServerSetupTest;
-import static org.junit.Assert.assertEquals;
+import jakarta.mail.MessagingException;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
public class EmailServiceLiveTest {
diff --git a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java
index 04ad47875f..c6850461ae 100644
--- a/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java
+++ b/core-java-modules/core-java-networking-2/src/test/java/com/baeldung/mail/mailwithattachment/MailWithAttachmentServiceLiveTest.java
@@ -1,20 +1,20 @@
package com.baeldung.mail.mailwithattachment;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
import com.icegreen.greenmail.configuration.GreenMailConfiguration;
import com.icegreen.greenmail.junit.GreenMailRule;
import com.icegreen.greenmail.util.GreenMailUtil;
import com.icegreen.greenmail.util.ServerSetupTest;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import javax.annotation.Resource;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import static org.junit.Assert.assertEquals;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Session;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
public class MailWithAttachmentServiceLiveTest {
@@ -29,7 +29,6 @@ public class MailWithAttachmentServiceLiveTest {
.withUser(USERNAME, PASSWORD)
);
- @Resource
private MailWithAttachmentService emailService;
@Before
@@ -73,5 +72,4 @@ public class MailWithAttachmentServiceLiveTest {
return GreenMailUtil.getBody(((MimeMultipart) receivedMessage.getContent())
.getBodyPart(2));
}
-
}
diff --git a/core-java-modules/core-java-networking-3/pom.xml b/core-java-modules/core-java-networking-3/pom.xml
index 4f373238ee..6d0374c598 100644
--- a/core-java-modules/core-java-networking-3/pom.xml
+++ b/core-java-modules/core-java-networking-3/pom.xml
@@ -30,9 +30,9 @@
${tomcat.embeded.version}
- com.sun.mail
- javax.mail
- ${javax.mail.version}
+ org.eclipse.angus
+ angus-mail
+ ${angus.mail.version}
@@ -95,7 +95,7 @@
5.3.3
1.32
0.17
- 1.6.2
+ 2.0.1
1.7
diff --git a/core-java-modules/core-java-networking-3/src/main/java/com/baeldung/downloadattachments/DownloadEmailAttachments.java b/core-java-modules/core-java-networking-3/src/main/java/com/baeldung/downloadattachments/DownloadEmailAttachments.java
index 4030f3b983..de726f6cbf 100644
--- a/core-java-modules/core-java-networking-3/src/main/java/com/baeldung/downloadattachments/DownloadEmailAttachments.java
+++ b/core-java-modules/core-java-networking-3/src/main/java/com/baeldung/downloadattachments/DownloadEmailAttachments.java
@@ -6,16 +6,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import javax.mail.Address;
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.NoSuchProviderException;
-import javax.mail.Part;
-import javax.mail.Session;
-import javax.mail.Store;
-import javax.mail.internet.MimeBodyPart;
+import jakarta.mail.Address;
+import jakarta.mail.Folder;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.NoSuchProviderException;
+import jakarta.mail.Part;
+import jakarta.mail.Session;
+import jakarta.mail.Store;
+import jakarta.mail.internet.MimeBodyPart;
public class DownloadEmailAttachments {
private String downloadDirectory;
@@ -24,7 +24,7 @@ public class DownloadEmailAttachments {
this.downloadDirectory = dir;
}
- public void downloadEmailAttachments(String host, String port, String userName, String password) throws NoSuchProviderException, MessagingException, IOException {
+ public void downloadEmailAttachments(String host, String port, String userName, String password) throws MessagingException, IOException {
Properties properties = setMailServerProperties(host, port);
Store store = setSessionStoreProperties(userName, password, properties);
Folder inbox = store.getFolder("INBOX");
@@ -67,7 +67,7 @@ public class DownloadEmailAttachments {
return downloadedAttachments;
}
- public Store setSessionStoreProperties(String userName, String password, Properties properties) throws NoSuchProviderException, MessagingException {
+ public Store setSessionStoreProperties(String userName, String password, Properties properties) throws MessagingException {
Session session = Session.getDefaultInstance(properties);
Store store = session.getStore("pop3");
diff --git a/logging-modules/logback/pom.xml b/logging-modules/logback/pom.xml
index 937a88da09..bef4b25f1b 100644
--- a/logging-modules/logback/pom.xml
+++ b/logging-modules/logback/pom.xml
@@ -65,14 +65,14 @@
- com.sun.mail
- javax.mail
- ${javax.mail.version}
+ org.eclipse.angus
+ angus-mail
+ ${angus.mail.version}
- javax.activation
- javax.activation-api
- ${javax.activation.version}
+ org.eclipse.angus
+ angus-activation
+ ${angus.activation.version}
runtime
@@ -116,8 +116,8 @@
20180130
0.1.5
3.3.5
- 1.6.2
- 1.2.0
+ 2.0.1
+ 2.0.0
1.3.5
2.0.4