从应用程序发送的电子邮件
我有一个场景,其中当有任何匹配(可以被视为触发器)时,必须从应用程序向客户发送电子邮件通知。基本上“from”id 是相同的,“to”id 会发生变化。
有哪些可用的电子邮件发送选项?我正在 Java/JBOSS 服务器中工作。我应该托管 SMTP 服务器吗?或者一个运行并依次发送电子邮件的 cron 作业......无论哪种方式,我都需要找到一种发送电子邮件的方法。我是这项技术的新手。任何意见表示赞赏。谢谢。
I have a scenario wherein When there is any match(can be considered to a trigger), an email notification has to be sent from the application to the customer. Basically 'from' id would be the same and 'to' changes.
What are the various email sending options available? I'm working in Java/JBOSS server. Should I host an SMTP server? Or a cron job which runs and in turn sends emails... either way I need to find out a method to send email. I'm new to this tech. Any inputs appreciated. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
1.) 如前所述,Javamail API 是最佳选择:
http://www.oracle.com/technetwork/java/javamail/index.html html
2.) 我进一步推荐 Java Mail API 的包装器,它确实可以简化电子邮件的构建(Mail API 很难用于构建 HTML/文本电子邮件)。我强烈推荐这个:
http://commons.apache.org/email/
3.) 作为邮件传输代理,我会不推荐使用 Java,而是使用专用的 SMTP 服务器,如前面提到的 postfix。对于 Javamail,SMTP 服务器可以是任意服务器,由您自己托管。
或者使用 google mail 之类的服务,您只需通过 java mail API 连接到它们即可。没有好的 Java SMTP 服务器可用,postifx 有很多选项(也涉及安全性),但在我看来,最好使用现有的基础设施。
通过 Java Mail,您可以使用当前的电子邮件提供商(或您很可能已经拥有的公司电子邮件服务器)。您的管理员只需创建一个新的电子邮件地址和帐户,然后您就可以使用 java mail api 通过该帐户发送邮件。
1.) As already stated, the Javamail API is the way to go:
http://www.oracle.com/technetwork/java/javamail/index.html
2.) I further would recommend a wrapper around the Java Mail API that really simplifies constructing your emails (The Mail API is very hard to work with constructing HTML/Text Emails). I would highly recommend this:
http://commons.apache.org/email/
3.) As Mail Transfer Agent I would not recommend a Java one but rather use a dedicated SMTP Server, like the mentioned postfix. With Javamail the SMTP Server can be any arbitrary server, hosted on your own.
Or use services like google mail and you simply connect to them via the java mail API. There are no good Java SMTP Servers available and postifx has plenty of options (also in regard to security) but in my opinion, it is best to use existing infrastructure.
With Java Mail you can use your current email provider (or the company email server you might most likely have already). Your admins only have to create a new email address and account and then you can send mails over this account with java mail api.
使用 JavaMail API 创建电子邮件客户端:
http://www.oracle .com/technetwork/java/javamail/index.html
如果您没有 SMTP 服务器,您可以安装 Postfix:
http://www.postfix.org/
Use the JavaMail API to create an e-mail client:
http://www.oracle.com/technetwork/java/javamail/index.html
If you don't have an SMTP server, you could install Postfix:
http://www.postfix.org/