How to download JavaMail API from Maven

If you want to use the core JavaMail API to send email, you have to get the JavaMail library – ‘mail.jar‘ and ‘activation.jar‘. Unfortunately, those libraries are not available in the Maven central repository, you have to download it from java.Net maven repository.

pom.xml


<project xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
  http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mkyong.common</groupId>
  <artifactId>SpringExample</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>SpringExample</name>
  <url>http://maven.apache.org</url>
  
  <repositories>
    <repository>
  	<id>Java.Net</id>
  	<url>http://download.java.net/maven/2/</url>
    </repository>
  </repositories>
  
  <dependencies>
    <!-- Java Mail API -->
    <dependency>
	 <groupId>javax.mail</groupId>
	 <artifactId>mail</artifactId>
	 <version>1.4.3</version>
    </dependency>
  </dependencies>
</project>

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
Jo Desmet
Guest
Jo Desmet
To be able to compile, and deploy on a JEE certified server, include this in your pom.xml: javax.mail javax.mail-api 1.5.5 provided If you need to deploy on a bare tomcat installation, or on a bare JRE, then also include this: com.sun.mail javax.mail 1.5.5 runtime the javax.mail group-id does not contain the latest releases for the Implementation. Note that disqus somehow modifies the correct case of ‘groupId’ and ‘artifactId’, so make sure to make corrections.
Lucio Crusca
Guest
Lucio Crusca

Javamail is now available in Maven Central too: http://search.maven.org/#artifactdetails|javax.mail|javax.mail-api|1.5.2|jar

trackback
Maven Tutorials | Tutorials

[…] Posts Maven dependency libraries not deploy in Eclipse IDEHow to download JavaMail API from MavenHow to download J2EE API (javaee.jar) from MavenMaven + Spring + JDBC ExampleHow to change Maven […]