How can I receive emails on a Java based system using spring?

I searched the Google and Spring documentation, but I can not find anything when I receive emails.

I need to create a client (sort of not a fully bloated client) that can receive emails from POP3 and IMAP. I already use Spring in the project, so Spring is the preference.

A lot of links point to James, but while it seems like a good project, it does not provide enough documentation, and I'm not even sure that it does what I do, i.e. just a small client capable of receiving emails.

+6
source share
2 answers

Spring integration was designed to solve such problems. In particular, it has adapters for receiving email . Here is an IMAP example from the documentation:

<mail:inbound-channel-adapter id="imapAdapter" store-uri="imaps://[username]:[password]@imap.gmail.com/INBOX" java-mail-properties="javaMailProperties" channel="recieveChannel" should-delete-messages="true" should-mark-messages-as-read="true" auto-startup="true"> <int:poller max-messages-per-poll="1" fixed-rate="5000"/> </mail:inbound-channel-adapter> 
+13
source

POP3 and IMAP are not protocols that receive email. They go out and take it from the server.

Official JavaMail API

provides a platform-independent and protocol-independent infrastructure for building mail and message applications.

Take a look!

+2
source

Source: https://habr.com/ru/post/907469/


All Articles