Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading mails using Spring email abstraction layer

Spring provides abstraction over JavaMail Api.

There are lot of examples to describe how to send mail using spring email abstraction layer.

but how can i read emails using this?

like image 511
a Learner Avatar asked Oct 17 '11 10:10

a Learner


People also ask

What is Spring framework used for?

The Spring Framework is an open-source framework for building enterprise Java applications. Spring aims to simplify the complex and cumbersome enterprise Java application development process by offering a framework that includes technologies such as: Aspect-oriented programming (AOP) Dependency injection (DI)


2 Answers

You can configure Spring to poll for emails from a POP or IMAP server

http://docs.spring.io/spring-integration/reference/html/mail.html

Or access directly.

MailReceiver receiver = new Pop3MailReceiver("pop3://usr:pwd@localhost/INBOX");
like image 186
Gordon Mackay Avatar answered Oct 16 '22 01:10

Gordon Mackay


Maybe because Spring does not have a built-in support for receiving e-mails?

http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mail.html:

24. Email

24.1 Introduction

The Spring Framework provides a helpful utility library for sending email that shields the user from the specifics of the underlying mailing system and is responsible for low level resource handling on behalf of the client.

If you want to receive e-mails you must use some external libraries, including Spring Integration with POP3 support.

like image 27
Tomasz Nurkiewicz Avatar answered Oct 16 '22 03:10

Tomasz Nurkiewicz