Java 应用程序接收传入电子邮件的最简单方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/561011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 12:51:59  来源:igfitidea点击:

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

javaemailsmtpemail-integrationsmtpd

提问by flybywire

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.

使用 commons-email 发送电子邮件很容易,使用 spring 则更容易。收到传入的电子邮件怎么办?是否有易于使用的 API 允许退回电子邮件、处理附件等。

回答by Peter ?tibrany

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

SubEthaSMTP 邮件服务器允许您创建自己的 SMTP 服务器来接收电子邮件。

回答by jcrossley3

Jamesis 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.

James可能是您最好的选择,但电子邮件处理极其复杂,不仅需要配置 MTA(James 服务器),还需要配置 DNS。过去,我发现通过来自非 Java MTA 的钩子(如 postfix)更容易启动我的处理程序。procmail 也可能对您有用。尽管如此,对于 Java MTA,James 还是很震惊的。

回答by guerda

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

Apache Commons Net是通过 POP3 获取邮件的完美库。不支持 IMAP。

回答by Urobe

Review the Mail component from apache camel

查看来自 apache camel 的邮件组件

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

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

回答by n002213f

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

在此处查看 jGuru 的 JavaMail 教程。有多种方法可以读取和分离附件。

回答by Jonik

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

看看 Sun 自己的JavaMailAPI 文档)是否适合您的需要。

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

我不确定最简单的方法,但至少它是一种广泛使用的方法。