Receiving email in Node.js

拈花ヽ惹草 提交于 2019-12-18 10:07:09

问题


I see a lot of Node.js modules out there that sends mail through SMTP.

But is there a module to receive mail?


回答1:


You are looking for an e-mail client library. Currently, there are 2 options (as mentioned here):

  • node-imap (IMAP)
  • n3 (POP3, experimental)

I never used them before, but usage is pretty straight forward (according to the docs). node-imap seems 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.




回答2:


The Mailin module 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.

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)




回答3:


If you want the actual server in node.js check out

  • https://github.com/ralphholzmann/node-smtp/blob/master/smtp.js
  • https://github.com/riegel/node.js-SMTP-server
  • https://github.com/aredridel/node-smtp/



回答4:


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-imap and mailparser nicely out of the box.



来源:https://stackoverflow.com/questions/5241409/receiving-email-in-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!