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.

flybywire
  • 261,858
  • 191
  • 397
  • 503
  • Similar question: [How to receive Email in Java EE application](https://stackoverflow.com/questions/2643791/) – sleske Jun 17 '22 at 06:36

6 Answers6

17

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

yegor256
  • 102,010
  • 123
  • 446
  • 597
Peter Štibraný
  • 32,463
  • 16
  • 90
  • 116
  • 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. – extraneon Feb 18 '09 at 13:41
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.

jcrossley3
  • 11,576
  • 4
  • 31
  • 32
  • 1
    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. – extraneon Feb 18 '09 at 13:39
  • 1
    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. – Richard Levasseur Feb 27 '09 at 18:01
2

Review the Mail component from apache camel

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

Urobe
  • 280
  • 3
  • 7
2

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

guerda
  • 23,388
  • 27
  • 97
  • 146
1

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

n002213f
  • 7,805
  • 13
  • 69
  • 105
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.

Jonik
  • 80,077
  • 70
  • 264
  • 372