javajakarta-mail

Where could we get com.sun.mail from?


We have a javax.mail dependency (here's its latest version). It has a class called javax.mail.internet.InternetAddress which has this import

import com.sun.mail.util.PropUtil;

Here's the only place it's used

    private static final boolean ignoreBogusGroupName = PropUtil.getBooleanSystemProperty("mail.mime.address.ignorebogusgroupname", true);

We have an OpenJDK-based JDK 8 distribution. It doesn't have com.sun.mail at all. It seems OpenJDK 8 itself doesn't have it either (at any rate, I downloaded the archive, manually inspected its contents and didn't find one)

InternetAddress from jakarta.mail doesn't have such an import (jars), it uses jakarta.mail.internet.MimeUtility instead. But migrating to jakarta appears risky (or at least troublesome, I remember the pain of transitioning to jakarta.servlet)

Where could we get com.sun.mail from (or otherwise solve this problem)?


Solution

  • If you go to the source repo for javax.mail (https://github.com/javaee/javamail) and look at its POM file, the dependency the POM uses for com.sun.mail is:

    <dependency>
       <groupId>com.sun.mail</groupId>
       <artifactId>javax.mail</artifactId>
       <version>${mail.version}</version>
    </dependency>
    

    where mail.version will be the version for the javax.mail dependency.

    Try adding that to your project's POM file.