有人知道 Java 的邮件 (SMTP) 传递库吗?
我想发送邮件而不用打扰用于投递的 SMTP 服务器.
I'd like to send mail without bothering with the SMTP-Server which is used for delivery.
所以 JavaMail API 对我不起作用,因为我必须指定 SMTP 服务器连接到.
So JavaMail API doesn't work for me because I have to specify a SMTP server to connect to.
我希望库通过查询邮件地址域的 MX 记录,自行找出哪个 SMTP 服务器负责哪个电子邮件地址.
I'd like the library to find out on its own which SMTP server is responsible for which email address by querying the MX record of the mail address domain.
我正在寻找类似 Aspirin 的东西.不幸的是,我不能使用 Aspirin 本身,因为开发在 2004 年停止,并且该库无法与现代垃圾邮件强化服务器正确通信.
I'm looking for something like Aspirin. Unfortunately I can't use Aspirin itself because the development stopped 2004 and the library fails to communicate with modern spam hardened servers correctly.
James 的可嵌入版本可以完成这项任务.但我还没有找到关于这是否可能的文档.
An embeddable version of James would do the task. But I haven't found documentation concerning whether this is possible.
或者有人知道我可以使用的其他库吗?
Or does anyone know about other libraries I could use?
推荐答案
这是完全错误的处理方式.
This is completely the wrong way to handle this.
任何连接到互联网的人都可以使用某种合法"的 SMTP 服务器来提交电子邮件——您的 ISP、您的办公室等.
Anyone connected to the internet will have some kind of "legit" SMTP server available to them to take the submission of email -- your ISP, your office, etc.
你想利用,因为他们为你做了几件事.
You WANT to leverage because they do several things for you.
1) 他们接受您的信息并负责处理该信息.放下后,就不再是你的问题了.
1) they take your message and the responsibility to handle that message. After you drop it off, it's not your problem anymore.
2) 任何邮件反垃圾邮件技术都由服务器处理.更好的是,当/如果这些技术发生变化(任何人的域键?),服务器会处理它,而不是你的代码.
2) Any mail de-spamming technologies are handled by the server. Even better, when/if those technologies change (Domain keys anyone?), the server handles it, not your code.
3) 作为该发送邮件系统的客户端,您已经拥有与该服务器通信所需的任何凭据.主要 SMTP 服务器通过身份验证、IP 范围等被锁定.
3) You, as a client of that sending mail system, already have whatever credentials you need to talk to that server. Main SMTP servers are locked down via authentication, IP range, etc.
4) 你不是在重新发明轮子.利用您拥有的基础设施.您是在编写应用程序还是邮件服务器?设置邮件服务器是一项通常很容易完成的日常任务.互联网上所有那些随意的愚蠢"用户都设法设置了电子邮件.
4) You're not reinventing the wheel. Leverage the infrastructure you have. Are you writing an application or a mail server? Setting up mail server is an every day task that is typically simple to do. All of those casual "dumb" users on the internet have managed to get email set up.
相关文章