I'd like to use spring support for sending mails. My project is built with maven-2 and I use spring-core 2.5.5 I tried to look in maven central repo for artifact to include in my pom.xml, and the only one I found is spring support. The problem is that the highest version in repo is 2.0.8 and it depends on spring-core v. 2.0.8. Should I add it and exclude from its dependencies spring-core, spring-aop and so on, or should I look for another artifact (but which one will do?) or use another repo? Which is the proper maven-2 artifact for org.springframework.mail and where can I find it?
Asked
Active
Viewed 7.1k times
91
-
1I got here for Spring Boot, so leaving a comment which might help someone in the future: Include this Maven Dependency: `
org.springframework.boot spring-boot-starter-mail
3 Answers
147
The mail stuff is found, rather bizarrely, in the context-support artifact.

skaffman
- 398,947
- 96
- 818
- 769
-
14spring framework is ridiculous.....where in [link](http://static.springsource.org/spring/docs/3.0.x/reference/mail.html) does it ever mention the need for "context-support". Hey Spring....only 1/2 the world has wasted their life in Maven.... – Jason Oct 30 '12 at 14:18
-
1... and all org.springframework.mail source assets are hosted in the [main *SpringSource/spring-framework* repository](https://github.com/SpringSource/spring-framework/tree/master/spring-context-support/src/main/java/org/springframework/mail). – Abdull Aug 17 '13 at 14:36
-
Any idea how to find this? Is there a reverse lookup table or something I can use? – Eaton Emmerich Mar 24 '22 at 10:17
35
<!-- ########### SPRING-CONTEXT-SUPPORT ############ -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>

WillEnsaba
- 756
- 1
- 8
- 23
1
For using MailSender
and SimpleMailMessage
through Spring you can use these imports in your code:
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
And add their jars in your project.
Otherwise if you are using maven then you have to make these imports in your source and then add dependencies :
- http://mvnrepository.com/artifact/org.springframework/spring-support/2.0.6
- http://mvnrepository.com/artifact/org.springframework/spring-context-support/3.2.0.RELEASE
You will get the mail support from both of them.

Najera
- 2,869
- 3
- 28
- 52

Pawan Saxena
- 521
- 1
- 4
- 14