There are at least two ways to send email from Nodejs using SendGrid:
Edit 2
So, if you're starting on a project now, I would suggest going with sendgrid-nodejs.
Original question:
Edit to make the question less opinion-based: What are the pros and cons to each approach? I have googled for days and not seen any comparison of the two. There is another StackOverflow question asking for differentiation between the two (among several other things) which has gone unanswered. So surely the answer to this will help others.
My specific usage, in case it helps focus the answers: I want to allow users of an iPhone app to invite others to use the app. They'll see the default invitation text in the app, and can customize it. The customized text is sent to my Nodejs server and added to a job queue. As the queue is processed, emails are sent. I want the emails to look nice, so I want to use HTML email templates (and a plaintext alternate body).
Scale-wise, this will start out very small but if the app is succssful could scale up rapidly.
Well, sendgrid-nodejs is a more popular repository. However, Nodemailer is the most popular module for sending emails with NodeJS.
SendGrid is a cloud-based SMTP provider that allows you to send email without having to maintain email servers. SendGrid manages all of the technical details, from scaling the infrastructure to ISP outreach and reputation monitoring to whitelist services and real time analytics.
Bookmark this question. Show activity on this post. Before changing some settings, e.g. host and port, it was working fine locally, but just won't work on production.
You'll find that you can achieve what you want to do using either library (nodemailer-sendgrid-transport was written by SendGrid too!) but given you suggest that you want to use HTML templates and plain text alternatives, you might want to take a look at using the SendGrid Node JS library because it'll give you easier access to some more advanced features, such as:
Template Engine - Which allows you to manage both HTML and plain text templates inside the SG dashboard rather than in your code - this could be handy for making quick changes, without the need to redeploy your app to production.
Advanced Suppression Management - Which allows you to group emails that users can then unsubscribe from, rather than completely unsubscribing from everything, ever.
It's worth noting that you could still use both these features with NodeMailer and nodemailer-sendgrid-transport, but the SendGrid NodeJS library directly exposes methods for these features.
Like I said, you can achieve what you want with either but I thought it was worth pointing out a few SendGrid specific things.
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