diff --git a/pom.xml b/pom.xml
index 7e1da68c..edddba54 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,12 +61,12 @@
provided
org.jvnet.mock-javamail
mock-javamail
- 1.12
+ 2.0
test
io.jenkins.plugins
- javax-mail-api
+ jakarta-mail-api
+ 2.0.0-5
org.mockito
diff --git a/src/main/java/hudson/cli/MailCommand.java b/src/main/java/hudson/cli/MailCommand.java
index fbf9e946..915c8ede 100644
--- a/src/main/java/hudson/cli/MailCommand.java
+++ b/src/main/java/hudson/cli/MailCommand.java
@@ -27,8 +27,8 @@
import hudson.Extension;
import jenkins.model.Jenkins;
-import javax.mail.internet.MimeMessage;
-import javax.mail.Transport;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.Transport;
/**
* Sends e-mail through Jenkins.
diff --git a/src/main/java/hudson/tasks/MailSender.java b/src/main/java/hudson/tasks/MailSender.java
index a84a9c03..861ce55c 100644
--- a/src/main/java/hudson/tasks/MailSender.java
+++ b/src/main/java/hudson/tasks/MailSender.java
@@ -41,12 +41,12 @@
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
-import javax.mail.Address;
-import javax.mail.MessagingException;
-import javax.mail.Transport;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
+import jakarta.mail.Address;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeMessage;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
diff --git a/src/main/java/hudson/tasks/Mailer.java b/src/main/java/hudson/tasks/Mailer.java
index 8145c943..89268ff9 100644
--- a/src/main/java/hudson/tasks/Mailer.java
+++ b/src/main/java/hudson/tasks/Mailer.java
@@ -60,16 +60,16 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
-import javax.mail.Address;
-import javax.mail.Authenticator;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.PasswordAuthentication;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
+import jakarta.mail.Address;
+import jakarta.mail.Authenticator;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.PasswordAuthentication;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeMessage;
import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.kohsuke.accmod.Restricted;
diff --git a/src/main/java/jenkins/plugins/mailer/tasks/MailAddressFilter.java b/src/main/java/jenkins/plugins/mailer/tasks/MailAddressFilter.java
index a0190389..02d7f29e 100644
--- a/src/main/java/jenkins/plugins/mailer/tasks/MailAddressFilter.java
+++ b/src/main/java/jenkins/plugins/mailer/tasks/MailAddressFilter.java
@@ -40,7 +40,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetAddress;
/**
* Checks email addresses if they should be excluded from sent emails.
diff --git a/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java b/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java
index e6b1b450..da93c5f5 100644
--- a/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java
+++ b/src/main/java/jenkins/plugins/mailer/tasks/MimeMessageBuilder.java
@@ -33,18 +33,18 @@
import org.jenkinsci.main.modules.instance_identity.InstanceIdentity;
import edu.umd.cs.findbugs.annotations.NonNull;
-import javax.mail.Address;
-import javax.mail.BodyPart;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.HeaderTokenizer;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import javax.mail.internet.MimeUtility;
+import jakarta.mail.Address;
+import jakarta.mail.BodyPart;
+import jakarta.mail.Message;
+import jakarta.mail.MessagingException;
+import jakarta.mail.Multipart;
+import jakarta.mail.internet.AddressException;
+import jakarta.mail.internet.HeaderTokenizer;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
+import jakarta.mail.internet.MimeUtility;
import java.io.UnsupportedEncodingException;
import java.security.interfaces.RSAPublicKey;
diff --git a/src/test/java/hudson/tasks/MailerTest.java b/src/test/java/hudson/tasks/MailerTest.java
index ab489fc0..dd18dd54 100644
--- a/src/test/java/hudson/tasks/MailerTest.java
+++ b/src/test/java/hudson/tasks/MailerTest.java
@@ -53,8 +53,8 @@
import org.jvnet.hudson.test.recipes.LocalData;
import org.jvnet.mock_javamail.Mailbox;
-import javax.mail.Address;
-import javax.mail.internet.InternetAddress;
+import jakarta.mail.Address;
+import jakarta.mail.internet.InternetAddress;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
diff --git a/src/test/java/jenkins/plugins/mailer/tasks/MailAddressFilterTest.java b/src/test/java/jenkins/plugins/mailer/tasks/MailAddressFilterTest.java
index 4707a08d..c3ec22f0 100644
--- a/src/test/java/jenkins/plugins/mailer/tasks/MailAddressFilterTest.java
+++ b/src/test/java/jenkins/plugins/mailer/tasks/MailAddressFilterTest.java
@@ -35,8 +35,8 @@
import java.util.List;
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 jenkins.model.Jenkins;
diff --git a/src/test/java/jenkins/plugins/mailer/tasks/MimeMessageBuilderTest.java b/src/test/java/jenkins/plugins/mailer/tasks/MimeMessageBuilderTest.java
index 1f7458d7..0e988ea1 100644
--- a/src/test/java/jenkins/plugins/mailer/tasks/MimeMessageBuilderTest.java
+++ b/src/test/java/jenkins/plugins/mailer/tasks/MimeMessageBuilderTest.java
@@ -35,11 +35,11 @@
import org.jvnet.mock_javamail.Mailbox;
import org.kohsuke.stapler.framework.io.WriterOutputStream;
-import javax.mail.Address;
-import javax.mail.Message;
-import javax.mail.Transport;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.mail.Address;
+import jakarta.mail.Message;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
import java.io.StringWriter;
import java.security.KeyFactory;