Emailing from your App
There are many npm packages that lets programmers create emails to send to people automatically. I have used two that is worth mentioning because of ease of use: nodemailer and SendGrid.
nodemailer is a popular npm package. After installing the package, the package needs to be required before it can be used. transporter is a variable that holds an object that will be used to send emails. It contains the service, for this example gmail, and the authentication information for which email account to use. The function sendWelcomeEmail adds to the transporter another object that contains details of the email to send, such as the email address to send it to, from whom, the subject of the email and the description of the email. This npm package by far requires no registration and simple to use.
SendGrid (https://sendgrid.com/) is an email service that has many features that keeps track of how the email is treated on the receiving end, such as if it was opened or treated as spam. It is used mostly for sending marketing emails. Users of this service can also create a signup form for the receivers signing up to get emails.
To use this service, the programmer needs to signup and create an API key. After the creation, the npm package for the service needs to be installed. The first two lines of code is required to use this package. Once the npm package is installed and the API key is obtained, the API key must be set so that the package knows who is using the package. Once set, the email creation is the same as using nodemailer except for what the objects contains as the transporter.
All in all, both emailing packages is easy to use except for one requiring a little more work to setup and the number of lines of code. Which packages to use is up to the programmer’s preference.