What is the easiest way for a Java application to receive incoming email?
Asked Answered
A

6

18

Sending email is easy with commons-email, and with spring it is even easier. What about receiving incoming email? Are there easy to use APIs that allow to bounce emails, process attachments, etc.

Afflict answered 18/2, 2009 at 13:17 Comment(1)
Similar question: How to receive Email in Java EE applicationTimmytimocracy
F
17

SubEthaSMTP Mail Server allows you to create your own SMTP Server for receiving emails.

Francois answered 18/2, 2009 at 13:36 Comment(1)
Definitely a very clean and accessible product. I have some experience with it and I can say there are not many libraries which are so easily integrated.Surefooted
C
5

James is probably your best bet, but email handling is extremely complex, requiring not only configuration of your MTA (the James server), but also DNS. In the past, I've found it easier to initiate my handlers via hooks from non-Java MTA's like postfix. And procmail might also be useful to you. For a Java MTA though, James rocks.

Chaschase answered 18/2, 2009 at 13:19 Comment(2)
James is a very complex product. If you only need to receive e-mail, and don't need anything else, use SubEthaSMTP. If you don't have experience wirth James, use SubEthaSMTP and a real e-mail server (postfix) in front of it and let that handle the complex stuff.Surefooted
James is very complex, and it has little subtleties one has to be aware of while configuring its (very, very verbose) xml file. If you need a mail server in java, James will work. If you need an application mail server, SubEtha+postfix will be much easier and sane.Shook
K
2

Apache Commons Net is the perfect library to fetch mails via POP3. IMAP is not supported.

Komsa answered 18/2, 2009 at 13:24 Comment(2)
mmm...but then I have two constantly poll the server, right? Instead of being a server and sitting idle until email arrives...Afflict
Answer out of date perhaps? Supported protocols include: IMAP(S)Whew
G
2

Review the Mail component from apache camel

http://camel.apache.org/mail.html

Greene answered 20/12, 2012 at 15:51 Comment(0)
S
1

Check jGuru's JavaMail tutorial here. There are ways to read and detach attachments.

Status answered 18/2, 2009 at 14:47 Comment(0)
C
0

See if Sun's own JavaMail (API docs) suits your needs.

I'm not sure about easiest, but at least it is a widely used way.

Clatter answered 18/2, 2009 at 13:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.