在 Node.js 中接收电子邮件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5241409/
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
Receiving email in Node.js
提问by foobar
I see a lot of Node.js modules out there that sends mail through SMTP.
我看到很多 Node.js 模块通过 SMTP 发送邮件。
But is there a module to receive mail?
但是有没有接收邮件的模块?
采纳答案by schaermu
You are looking for an e-mail client library. Currently, there are 2 options (as mentioned here):
您正在寻找电子邮件客户端库。目前,有2个选项(如提到这里):
I never used them before, but usage is pretty straight forward (according to the docs). node-imapseems to be the more stable library and it has been tested against gmail. If IMAP is an option in your environment, i'd stick with node-imap.
我以前从未使用过它们,但使用起来非常简单(根据文档)。node-imap似乎是更稳定的库,并且已经针对 gmail 进行了测试。如果 IMAP 是您环境中的一个选项,我会坚持使用node-imap。
回答by Flolagale
The Mailinmodule allows you to receive emails, parse them and post them to a webhook of your choice. It is based on simplesmtp. It also checks the dkim and spf, computes a spamassassin score and determines the message language.
该Mailin模块,可以接收电子邮件,解析它们,并将它们上传到您选择的网络挂接。它基于simplesmtp。它还检查 dkim 和 spf,计算 spamassassin 分数并确定消息语言。
Even if it does not fit your needs exactly, you can have a look at the code, it might help you. (Disclaimer: I am the maintainer of Mailin)
即使它不完全符合您的需求,您也可以查看代码,它可能对您有所帮助。(免责声明:我是Mailin 的维护者)
回答by Drew LeSueur
If you want the actual server in node.js check out
如果您想要 node.js 中的实际服务器,请查看
回答by Anthony
The solution that I found is mail-listener2. I was able to get up and running with this in just a few minutes, it ties in node-imapand mailparsernicely out of the box.
我找到的解决方案是mail-listener2。我能够在短短几分钟内启动并运行它,它开箱即用地与node-imap和mailparser联系在一起。

