I need to build an email backend that can receive email, send email, store them in the db, like other all email services, such as Gmail or Yahoo.
Which module should I use to build such app? I searched about this, but it's all about nodemailer, which is just a sending module.
Depends on what you actually want with the backend.
For parsing mail messages i should use a package like mailparser. It tries to parse the source in different objects. Like to, cc, bcc, attachments, body etc.
For loading the messages, you can use one of the several IMAP clients. Store them with the mysql package.
Sending ofcourse with nodemailer.
The big question stays, what is the purpose of the backend. Creating a mail backend is not a easy task. Loading from IMAP and sending by SMTP is not the problem. But if you want create a service like Gmail or Yahoo, you need think about a lot aspects, like SPAM protection, queueing of mail, throttling of the outgoing mail and a lot more.
Related
I would like to find out how, using Node.js, Express, Typeorm I can send notifications at random times to users to add a post etc.
I would like to create something of the BeReal sort. Notifications should be sent according to the user's selected time zone at random times.
If you want to send automated notifications, I'd recommend using
node-cron. However, for your case, I'd propose to add a timeZone
indicative information in the database to link the user with the
timeZone(you can find it in HTTP Requests, update it after each
login).
For the actual sending of the notifications, I think you should use
some third party service like Google Firebase for mobile
notifications, and web-push for web applications.
I'm trying to use the emailjs (https://github.com/eleith/emailjs) for sending emails in nodejs.
I want to check if email exists before sending it and I do not want to send an email to know this.
So, My question is: How to check if an email address exists on the remote server?
At the network level, receiving and sending email are different operations. In a typical email client (like outlook or a wwebmail program) they appear integrated, but that is an elaborate illusion.
Your question mentioned a npm module to use SMTP to send emails. That's the way email clients do it.
Email clients use the POP3 protocol and sometimes the IMAP protocol to read messages from mailboxes on email servers. Some npm modules handling pop3 are available for node.js, and you can use one. But you will have to create the code to "know this email exists" as you put it in your question. You will read emails from the mailbox -- all of them! -- and examine them for the information you need to "know this email exists." If the inbox you read also belongs to a person, you need to be careful to tell POP3 to leave the messages on the server.
I'm able to generate the document:
But they are not showing up as requiring action, nor are emails being generated for them:
For reference they were sent to myself (same email)
Check your spam folder and also make sure the emails aren't getting stopped by security software, firewalls, or any other type of network filtering. Try testing with external email addresses to help debug as well, for instance use a gmail or yahoo email etc.
I am new to node.js where in my requirement is to grab received email subject, attachment and email body using node.js I am not able to find any solutions. Can anyone suggest me what kind of approach I should take.
I've read that nodemailer only permits to send mail (if I m not wrong).
You should use a librarie that allow you to receive message, like using POP3 protcole (https://www.npmjs.com/search?q=pop3)
In my application im using mailgun module to send and receive emails using node.js.I don't know how to receive the incoming emails.I created route to receive the incoming email.but its not working.
Mailgun is simply posting URL encoded form data.
Check out this discussion on receiving POST data in node.js: How do you extract POST data in Node.js?
Also it's worth noting that for whatever mail-header-related reasons, if you have mailgun set to forward something to a#b.com, then messages sent from a#b.com will not show up back in your inbox. Send mail from a different address. Note that mailgun can sometimes tell if you're using the Send As feature in gmail, and will know your main address.