Main Tutorials

Maven – How to download JavaMail API

JavaMail is now available in Maven Central repository.

pom.xml

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

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.

References

About Author

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

Comments

Subscribe
Notify of
3 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Jo Desmet
7 years ago

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
9 years ago

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