I see a lot of Node.js modules out there that sends mail through SMTP.
But is there a module to receive mail?
Whether you're building the next Gmail, cutting-edge email marketing software, or just want to program notifications into your Node. js app, it's easy to send emails using readily-made tools and services. Node. js is one of the most popular (if not the most popular) server-side runtime environment for web applications.
The Simple Mail Transfer Protocol (SMTP) is used for sending and receiving e-mail between e-mail clients and servers.
const Imap = require('imap'); const inspect = require('util'). inspect; const simpleParser = require('mailparser'). simpleParser; const imap = new Imap({ user: '[email protected]', password: 'mypassword', host: 'imap.gmail.com', port: 993, tls: true }); function openInbox(callback) { imap.
Create and send an emailSelect Home > New Email. Add recipients, a subject, and a message in the email body. Select Send.
You are looking for an e-mail client library. Currently, there are 2 options (as mentioned here):
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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With