Balaji Vignesh
Balaji Vignesh

Reputation: 456

Maven dependency for javax.mail

What is the maven dependency i should add for

import javax.mail.*;
import javax.mail.internet.*;

Adding the maven dependency from here http://mvnrepository.com/artifact/javax.mail/mail/1.5.0-b01 makes some of the jersey dependencies unable to retrieve error. What do you think is going wrong?

Upvotes: 6

Views: 37487

Answers (4)

y.z
y.z

Reputation: 31

Last version from https://mvnrepository.com, Aug 29, 2018:

<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>javax.mail-api</artifactId>
    <version>1.6.2</version>
</dependency>

Upvotes: 0

Anton Yuriev
Anton Yuriev

Reputation: 628

For Java 21 and later jakarta.mail should be used instead of javax.mail.

import jakarta.mail.*;

Dependencies:

<dependency>
    <groupId>jakarta.mail</groupId>
    <artifactId>jakarta.mail-api</artifactId>
    <version>${jakarta.mail-api.version}</version>
</dependency>
<dependency>
    <groupId>org.eclipse.angus</groupId>
    <artifactId>jakarta.mail</artifactId>
    <version>${jakarta.mail.version}</version>
    <scope>runtime</scope>
</dependency>

Upvotes: 0

Mitul Gedeeya
Mitul Gedeeya

Reputation: 896

We are using following dependency:

    <dependency>
        <groupId>com.sun.mail</groupId>
        <artifactId>javax.mail</artifactId>
    </dependency>

Upvotes: 3

tquadrat
tquadrat

Reputation: 4044

The version 1.6.3 had been the last version of JavaMail; since 2019-07-03, the new name for it is "Jakarta Mail".

Together with the name change also the Maven coordinates got different:

<dependency>
  <groupId>com.sun.mail</groupId>
  <artifactId>jakarta.mail</artifactId>
  <version>…</version>
</dependency>

The project homepage can be found here: https://eclipse-ee4j.github.io/mail/ https://projects.eclipse.org/projects/ee4j.mail

Upvotes: 5

Related Questions