SendGrid-nodejs or Nodemailer?

There are at least two ways to send email from Nodejs using SendGrid:

Edit 2

SendGrid has stopped supporting nodemailer-sendgrid transport today.

So, if you are starting a project now, I would suggest going with sendgrid-nodejs.


The original question:

Change to make the question less opinion-based: What are the pros and cons of each approach? I searched the Internet for many days and did not see any comparison of the two. There is another StackOverflow question asking for a distinction between the two (among several other things) that went unanswered. So the answer to this question will help others.

My specific use, if it helps focus answers: I want users of the iPhone application to suggest other users to use this application. They will see the default invitation text in the application and can customize it. Customized text is sent to my Nodejs server and added to the job queue. When the queue is processed, emails are sent. I want emails to look beautiful, so I want to use HTML email templates (and plain text).

Scaling, it will start very little, but if the application is successful, it can grow rapidly.

+6
source share
2 answers

You will find that you can achieve what you want to do using either a library ( nodemailer-sendgrid-transport was also written by SendGrid!), But given that you want to use HTML templates and plain text alternatives, you can take a look at using the library SendGrid Node JS, because it will facilitate access to some additional functions, such as:

The Engine template β€” which allows you to manage both HTML and text templates inside the SG control panel rather than your code β€” can be convenient for quick changes without having to redeploy your application for production.

Advanced Suppression Management - allows you to group emails that users can cancel, and not completely unsubscribe from everything.

It is worth noting that you can still use both of these functions using NodeMailer and nodemailer-sendgrid-transport , but the SendGrid NodeJS library directly provides methods for these features.

As I said, you can achieve what you want, but I thought it was worth noting a few special features of SendGrid.

+3
source

Well, sendgrid-nodejs is a more popular repository.

However, Nodemailer is the most popular module for sending email using NodeJS. I have been using it for several months and I am very satisfied.

If you are worried about the future of your application, you should think that Nodemailer is used not only with Sendgrid, but also with many other competitors. Therefore, if you have a problem with Sendgrid, you can easily switch to another email delivery service without having to learn another API.

Therefore, I suggest you use nodemailer-sendgrid-transport, and if you find errors, correct them with PR: P

+5
source

Source: https://habr.com/ru/post/983340/


All Articles