diff --git a/README.adoc b/README.adoc
index 6b373caa4..c09cd0167 100644
--- a/README.adoc
+++ b/README.adoc
@@ -106,11 +106,11 @@ This section allows you to specify recipients for each type of email trigger as
=== Pre-send scripts and post-send scripts
-This feature allows you to write a script that can modify the https://docs.oracle.com/javaee/7/api/javax/mail/internet/MimeMessage.html[`MimeMessage`] object before or after sending the email.
+This feature allows you to write a script that can modify the https://eclipse-ee4j.github.io/mail/docs/api/jakarta.mail/jakarta/mail/internet/MimeMessage.html[`MimeMessage`] object before or after sending the email.
This allows adding custom headers, modifying the body, etc.
Predefined variables include:
-`msg` (https://docs.oracle.com/javaee/7/api/javax/mail/internet/MimeMessage.html[`javax.mail.internet.MimeMessage`]):: The MIME email message object, which can be modified.
+`msg` (https://eclipse-ee4j.github.io/mail/docs/api/jakarta.mail/jakarta/mail/internet/MimeMessage.html[`jakarta.mail.internet.MimeMessage`]):: The MIME email message object, which can be modified.
`logger` (https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html[`java.io.PrintStream`]):: A `PrintStream` that can be used to log messages to the build log.
`build` (https://javadoc.jenkins.io/hudson/model/AbstractBuild.html[`hudson.model.AbstractBuild`]):: The build this message belongs to (only use with Freestyle projects).
`run` (https://javadoc.jenkins.io/hudson/model/Run.html[`hudson.model.Run`]):: The build this message belongs to (may be used with Freestyle projects or Pipeline).
diff --git a/docs/recipes.adoc b/docs/recipes.adoc
index cc10aaee4..857f98874 100644
--- a/docs/recipes.adoc
+++ b/docs/recipes.adoc
@@ -48,9 +48,9 @@ To filter out the recipients that *do not* contain `@example.com`:
.Filtering recipients on a domain
[source,groovy]
----
-recipients = msg.getRecipients(javax.mail.Message.RecipientType.TO)
+recipients = msg.getRecipients(jakarta.mail.Message.RecipientType.TO)
filtered = recipients.findAll { addr -> addr.toString().endsWith('@example.com') }
-msg.setRecipients(javax.mail.Message.RecipientType.TO, filtered as javax.mail.Address[])
+msg.setRecipients(jakarta.mail.Message.RecipientType.TO, filtered as jakarta.mail.Address[])
----
==== Filtering recipients on a whitelist
@@ -72,9 +72,9 @@ def includedInWhitelist(addr) {
return 0
}
-recipients = msg.getRecipients(javax.mail.Message.RecipientType.TO)
+recipients = msg.getRecipients(jakarta.mail.Message.RecipientType.TO)
filtered = recipients.findAll { addr -> includedInWhitelist(addr) > 0 }
-msg.setRecipients(javax.mail.Message.RecipientType.TO, filtered as javax.mail.Address[])
+msg.setRecipients(jakarta.mail.Message.RecipientType.TO, filtered as jakarta.mail.Address[])
----
== Post-send scripts
diff --git a/pom.xml b/pom.xml
index 8e97fc7e3..9198bd058 100644
--- a/pom.xml
+++ b/pom.xml
@@ -143,6 +143,7 @@
org.jenkins-ci.plugins
mailer
+ 410.va_7940d9ded39
org.jenkins-ci.plugins
@@ -218,12 +219,12 @@
test
org.jvnet.mock-javamail
mock-javamail
- 1.12
+ 2.0
test
io.jenkins.plugins
- javax-mail-api
- 1.6.2-5
+ jakarta-mail-api
+ 2.0.0-5
junit
diff --git a/src/main/java/hudson/plugins/emailext/AttachmentUtils.java b/src/main/java/hudson/plugins/emailext/AttachmentUtils.java
index 3eb4325d9..813980a84 100644
--- a/src/main/java/hudson/plugins/emailext/AttachmentUtils.java
+++ b/src/main/java/hudson/plugins/emailext/AttachmentUtils.java
@@ -17,13 +17,13 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import javax.activation.DataHandler;
-import javax.activation.DataSource;
-import javax.activation.FileTypeMap;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeUtility;
+import jakarta.activation.DataHandler;
+import jakarta.activation.DataSource;
+import jakarta.activation.FileTypeMap;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeUtility;
import org.apache.commons.lang.StringUtils;
/**
diff --git a/src/main/java/hudson/plugins/emailext/EmailExtRecipientStep.java b/src/main/java/hudson/plugins/emailext/EmailExtRecipientStep.java
index 7f24d10ab..bf74bec4a 100644
--- a/src/main/java/hudson/plugins/emailext/EmailExtRecipientStep.java
+++ b/src/main/java/hudson/plugins/emailext/EmailExtRecipientStep.java
@@ -12,7 +12,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.steps.Step;
import org.jenkinsci.plugins.workflow.steps.StepContext;
diff --git a/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java b/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java
index 116c86e4f..83d61e15b 100644
--- a/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java
+++ b/src/main/java/hudson/plugins/emailext/EmailRecipientUtils.java
@@ -13,9 +13,9 @@
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.MessagingException;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
diff --git a/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java b/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
index 9fd826fa6..ef022b683 100644
--- a/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
+++ b/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
@@ -63,18 +63,18 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.SendFailedException;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.mail.Address;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.SendFailedException;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.codehaus.groovy.control.CompilerConfiguration;
diff --git a/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java b/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
index e9aa3590b..32bcb6fbc 100644
--- a/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
+++ b/src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
@@ -32,11 +32,11 @@
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.Authenticator;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.Authenticator;
+import jakarta.mail.PasswordAuthentication;
+import jakarta.mail.Session;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import net.sf.json.JSONObject;
diff --git a/src/main/java/hudson/plugins/emailext/RecipientListStringAnalyser.java b/src/main/java/hudson/plugins/emailext/RecipientListStringAnalyser.java
index 7f979e873..62d3594e0 100644
--- a/src/main/java/hudson/plugins/emailext/RecipientListStringAnalyser.java
+++ b/src/main/java/hudson/plugins/emailext/RecipientListStringAnalyser.java
@@ -1,7 +1,7 @@
package hudson.plugins.emailext;
import hudson.model.TaskListener;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
class RecipientListStringAnalyser {
diff --git a/src/main/java/hudson/plugins/emailext/SizedDataSource.java b/src/main/java/hudson/plugins/emailext/SizedDataSource.java
index 27fcec20c..54c1f9711 100644
--- a/src/main/java/hudson/plugins/emailext/SizedDataSource.java
+++ b/src/main/java/hudson/plugins/emailext/SizedDataSource.java
@@ -1,6 +1,6 @@
package hudson.plugins.emailext;
-import javax.activation.DataSource;
+import jakarta.activation.DataSource;
public interface SizedDataSource extends DataSource {
long getSize();
diff --git a/src/main/java/hudson/plugins/emailext/groovy/sandbox/MimeMessageInstanceWhitelist.java b/src/main/java/hudson/plugins/emailext/groovy/sandbox/MimeMessageInstanceWhitelist.java
index 05f631595..fe10770fe 100644
--- a/src/main/java/hudson/plugins/emailext/groovy/sandbox/MimeMessageInstanceWhitelist.java
+++ b/src/main/java/hudson/plugins/emailext/groovy/sandbox/MimeMessageInstanceWhitelist.java
@@ -2,7 +2,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import java.lang.reflect.Method;
-import javax.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMessage;
/**
* {@link org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist} of explicit {@link MimeMessage} instances.
diff --git a/src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJavaxMailWhitelist.java b/src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJakartaMailWhitelist.java
similarity index 66%
rename from src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJavaxMailWhitelist.java
rename to src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJakartaMailWhitelist.java
index b51fea1e2..65b9d6393 100644
--- a/src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJavaxMailWhitelist.java
+++ b/src/main/java/hudson/plugins/emailext/groovy/sandbox/StaticJakartaMailWhitelist.java
@@ -10,8 +10,8 @@
//TODO should probably be moved into default lists in script-security
@Restricted(NoExternalUse.class)
@Extension
-public class StaticJavaxMailWhitelist extends ProxyWhitelist {
- public StaticJavaxMailWhitelist() throws IOException {
- super(StaticWhitelist.from(StaticJavaxMailWhitelist.class.getResource("javax.mail.whitelist")));
+public class StaticJakartaMailWhitelist extends ProxyWhitelist {
+ public StaticJakartaMailWhitelist() throws IOException {
+ super(StaticWhitelist.from(StaticJakartaMailWhitelist.class.getResource("jakarta.mail.whitelist")));
}
}
diff --git a/src/main/java/hudson/plugins/emailext/plugins/RecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/RecipientProvider.java
index 5a037465c..49c038d70 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/RecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/RecipientProvider.java
@@ -14,7 +14,7 @@
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/BuildUserRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/BuildUserRecipientProvider.java
index 1ce199c58..96fcf8f59 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/BuildUserRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/BuildUserRecipientProvider.java
@@ -14,7 +14,7 @@
import java.io.PrintStream;
import java.util.Collections;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java
index 83f639a39..dbf9c780f 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/CulpritsRecipientProvider.java
@@ -21,7 +21,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import jenkins.scm.RunWithSCM;
import org.jenkinsci.Symbol;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/DevelopersRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/DevelopersRecipientProvider.java
index 0b65b4914..057353331 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/DevelopersRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/DevelopersRecipientProvider.java
@@ -12,7 +12,7 @@
import java.io.PrintStream;
import java.util.Collections;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java
index 3d3c6dfe6..d0276aefc 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/FailingTestSuspectsRecipientProvider.java
@@ -39,7 +39,7 @@
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java
index 09b4d9cf7..489bb45ba 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/FirstFailingBuildSuspectsRecipientProvider.java
@@ -38,7 +38,7 @@
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/ListRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/ListRecipientProvider.java
index 698b8f49e..7be6d3066 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/ListRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/ListRecipientProvider.java
@@ -19,8 +19,8 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.MessagingException;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.MessagingException;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java
index 33df22d96..2932e8dbc 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/RecipientProviderUtilities.java
@@ -43,7 +43,7 @@
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import jenkins.scm.RunWithSCM;
import org.springframework.security.core.Authentication;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java
index 90b1011e5..ec1155855 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java
@@ -15,7 +15,7 @@
import java.io.PrintStream;
import java.util.Collections;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
diff --git a/src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java b/src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java
index 87d811e2c..89fea1a83 100644
--- a/src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java
+++ b/src/main/java/hudson/plugins/emailext/plugins/recipients/UpstreamComitterRecipientProvider.java
@@ -18,7 +18,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import jenkins.scm.RunWithSCM;
import org.jenkinsci.Symbol;
diff --git a/src/main/resources/hudson/plugins/emailext/groovy/sandbox/jakarta.mail.whitelist b/src/main/resources/hudson/plugins/emailext/groovy/sandbox/jakarta.mail.whitelist
new file mode 100644
index 000000000..fb1194aca
--- /dev/null
+++ b/src/main/resources/hudson/plugins/emailext/groovy/sandbox/jakarta.mail.whitelist
@@ -0,0 +1,3 @@
+staticField jakarta.mail.Message$RecipientType BCC
+staticField jakarta.mail.Message$RecipientType CC
+staticField jakarta.mail.Message$RecipientType TO
\ No newline at end of file
diff --git a/src/main/resources/hudson/plugins/emailext/groovy/sandbox/javax.mail.whitelist b/src/main/resources/hudson/plugins/emailext/groovy/sandbox/javax.mail.whitelist
deleted file mode 100644
index fd6fe6c21..000000000
--- a/src/main/resources/hudson/plugins/emailext/groovy/sandbox/javax.mail.whitelist
+++ /dev/null
@@ -1,3 +0,0 @@
-staticField javax.mail.Message$RecipientType BCC
-staticField javax.mail.Message$RecipientType CC
-staticField javax.mail.Message$RecipientType TO
\ No newline at end of file
diff --git a/src/test/java/hudson/plugins/emailext/AttachmentUtilsTest.java b/src/test/java/hudson/plugins/emailext/AttachmentUtilsTest.java
index bb4aa0abf..c7ec17571 100644
--- a/src/test/java/hudson/plugins/emailext/AttachmentUtilsTest.java
+++ b/src/test/java/hudson/plugins/emailext/AttachmentUtilsTest.java
@@ -28,11 +28,11 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimeUtility;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
+import jakarta.mail.internet.MimeUtility;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Rule;
diff --git a/src/test/java/hudson/plugins/emailext/EmailExtStepTest.java b/src/test/java/hudson/plugins/emailext/EmailExtStepTest.java
index cce6e87d1..c7ac98d52 100644
--- a/src/test/java/hudson/plugins/emailext/EmailExtStepTest.java
+++ b/src/test/java/hudson/plugins/emailext/EmailExtStepTest.java
@@ -10,10 +10,10 @@
import java.net.URL;
import java.util.Collections;
import java.util.Set;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
import org.apache.commons.lang.StringEscapeUtils;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
diff --git a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorJCasCTest.java b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorJCasCTest.java
index d744322f6..5037d9495 100644
--- a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorJCasCTest.java
+++ b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorJCasCTest.java
@@ -34,8 +34,8 @@
import org.junit.rules.TestName;
import org.mockito.Mockito;
-import javax.mail.Authenticator;
-import javax.mail.PasswordAuthentication;
+import jakarta.mail.Authenticator;
+import jakarta.mail.PasswordAuthentication;
public class ExtendedEmailPublisherDescriptorJCasCTest {
diff --git a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorTest.java b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorTest.java
index ca53e8760..be2061229 100644
--- a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorTest.java
+++ b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptorTest.java
@@ -64,7 +64,7 @@
import java.util.List;
import java.util.Optional;
import java.util.function.BiFunction;
-import javax.mail.Authenticator;
+import jakarta.mail.Authenticator;
import jenkins.model.Jenkins;
import org.apache.xpath.Arg;
import org.junit.Rule;
diff --git a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherMatrixTest.java b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherMatrixTest.java
index f0406e39e..e81a2848c 100644
--- a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherMatrixTest.java
+++ b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherMatrixTest.java
@@ -21,10 +21,10 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java
index 71445de15..b927b344a 100644
--- a/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java
+++ b/src/test/java/hudson/plugins/emailext/ExtendedEmailPublisherTest.java
@@ -50,14 +50,14 @@
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import javax.mail.Address;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.mail.Address;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Session;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import net.sf.json.JSONObject;
@@ -655,7 +655,7 @@ public void testCancelFromPresendScriptCausesNoEmailWithCodeAfterSecured() throw
@Issue("JENKINS-22777")
public void testEmergencyRerouteOverridesPresendScript() throws Exception {
publisher.getDescriptor().setEmergencyReroute("emergency@foo.com");
- publisher.setPresendScript("import javax.mail.Message.RecipientType\n"
+ publisher.setPresendScript("import jakarta.mail.Message.RecipientType\n"
+ "msg.setRecipients(RecipientType.TO, 'slide.o.mix@xxx.com')");
SuccessTrigger successTrigger = new SuccessTrigger(recProviders, "$DEFAULT_RECIPIENTS",
"$DEFAULT_REPLYTO", "$DEFAULT_SUBJECT", "$DEFAULT_CONTENT", "", 0, "project");
@@ -714,7 +714,7 @@ public void testNoCancelFromPresendScriptCausesEmailSecure() throws Exception {
@Test
public void testPresendScriptModifiesTo() throws Exception {
- publisher.setPresendScript("import javax.mail.Message.RecipientType\n"
+ publisher.setPresendScript("import jakarta.mail.Message.RecipientType\n"
+ "msg.setRecipients(RecipientType.TO, 'slide.o.mix@xxx.com')");
SuccessTrigger successTrigger = new SuccessTrigger(recProviders, "$DEFAULT_RECIPIENTS",
"$DEFAULT_REPLYTO", "$DEFAULT_SUBJECT", "$DEFAULT_CONTENT", "", 0, "project");
@@ -759,7 +759,7 @@ public void testPresendScriptModifiesToUsingProjectExternalScriptSecured() throw
}
private void verifyPresendScriptModifiesToUsingProjectExternalScript() throws Exception {
- publisher.setPresendScript("import javax.mail.Message.RecipientType\n"
+ publisher.setPresendScript("import jakarta.mail.Message.RecipientType\n"
+ "import hudson.plugins.emailext.ExtendedEmailPublisherTestHelper\n"
+ "msg.setRecipients(RecipientType.TO, ExtendedEmailPublisherTestHelper.to())");
SuccessTrigger successTrigger = new SuccessTrigger(recProviders, "$DEFAULT_RECIPIENTS",
@@ -801,7 +801,7 @@ public void testPresendScriptModifiesToUsingGlobalExternalScriptSecure() throws
}
private void verifyPresendScriptModifiesToUsingGlobalExternalScript() throws Exception {
- publisher.setPresendScript("import javax.mail.Message.RecipientType\n"
+ publisher.setPresendScript("import jakarta.mail.Message.RecipientType\n"
+ "import hudson.plugins.emailext.ExtendedEmailPublisherTestHelper\n"
+ "msg.setRecipients(RecipientType.TO, ExtendedEmailPublisherTestHelper.to())");
SuccessTrigger successTrigger = new SuccessTrigger(recProviders, "$DEFAULT_RECIPIENTS",
diff --git a/src/test/java/hudson/plugins/emailext/RecipientListStringAnalyserTest.java b/src/test/java/hudson/plugins/emailext/RecipientListStringAnalyserTest.java
index 4b901dd4e..8e5d9db87 100644
--- a/src/test/java/hudson/plugins/emailext/RecipientListStringAnalyserTest.java
+++ b/src/test/java/hudson/plugins/emailext/RecipientListStringAnalyserTest.java
@@ -2,7 +2,7 @@
import static org.junit.Assert.assertEquals;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
import org.junit.Test;
public class RecipientListStringAnalyserTest {
diff --git a/src/test/java/hudson/plugins/emailext/groovy/sandbox/ObjectInstanceWhitelistTest.java b/src/test/java/hudson/plugins/emailext/groovy/sandbox/ObjectInstanceWhitelistTest.java
index 0760cd812..892f10781 100644
--- a/src/test/java/hudson/plugins/emailext/groovy/sandbox/ObjectInstanceWhitelistTest.java
+++ b/src/test/java/hudson/plugins/emailext/groovy/sandbox/ObjectInstanceWhitelistTest.java
@@ -4,9 +4,9 @@
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Method;
-import javax.mail.Part;
-import javax.mail.Session;
-import javax.mail.internet.MimeMessage;
+import jakarta.mail.Part;
+import jakarta.mail.Session;
+import jakarta.mail.internet.MimeMessage;
import org.junit.Test;
/**
diff --git a/src/test/java/hudson/plugins/emailext/plugins/content/ScriptContentTest.java b/src/test/java/hudson/plugins/emailext/plugins/content/ScriptContentTest.java
index 15a35c37e..eba89aaa2 100644
--- a/src/test/java/hudson/plugins/emailext/plugins/content/ScriptContentTest.java
+++ b/src/test/java/hudson/plugins/emailext/plugins/content/ScriptContentTest.java
@@ -36,7 +36,7 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
-import javax.mail.Message;
+import jakarta.mail.Message;
import jenkins.model.JenkinsLocationConfiguration;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
diff --git a/src/test/java/hudson/plugins/emailext/plugins/content/TriggerNameContentTest.java b/src/test/java/hudson/plugins/emailext/plugins/content/TriggerNameContentTest.java
index 2e2de38e2..90d6aacd3 100644
--- a/src/test/java/hudson/plugins/emailext/plugins/content/TriggerNameContentTest.java
+++ b/src/test/java/hudson/plugins/emailext/plugins/content/TriggerNameContentTest.java
@@ -13,7 +13,7 @@
import hudson.plugins.emailext.plugins.trigger.PreBuildTrigger;
import java.util.Collections;
import java.util.List;
-import javax.mail.Message;
+import jakarta.mail.Message;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/src/test/java/hudson/plugins/emailext/plugins/recipients/TestUtilities.java b/src/test/java/hudson/plugins/emailext/plugins/recipients/TestUtilities.java
index 7baf895e1..4af7806df 100644
--- a/src/test/java/hudson/plugins/emailext/plugins/recipients/TestUtilities.java
+++ b/src/test/java/hudson/plugins/emailext/plugins/recipients/TestUtilities.java
@@ -36,8 +36,8 @@
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Set;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
/* package private */ final class TestUtilities {
private static final String AT_DOMAIN = "@DOMAIN";
diff --git a/src/test/java/hudson/plugins/emailext/recipients/EmailRecipientUtilsTest.java b/src/test/java/hudson/plugins/emailext/recipients/EmailRecipientUtilsTest.java
index c3ef1beaa..2703b91a6 100644
--- a/src/test/java/hudson/plugins/emailext/recipients/EmailRecipientUtilsTest.java
+++ b/src/test/java/hudson/plugins/emailext/recipients/EmailRecipientUtilsTest.java
@@ -15,8 +15,8 @@
import java.io.UnsupportedEncodingException;
import java.util.LinkedHashSet;
import java.util.Set;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Before;
import org.junit.Rule;