SendGrid Mailer

API configuration/API keys

npm install --save sendgrid @sendgrid/mail

Environment Variables

So in my process, I did NOT follow steps 3–5 but have added them here for clarity.

Route Handlers

While SendGrid offers a lot of the functionality above, it won’t be useful for my application on the backend. So by creating my own classes I am able to execute both requests with the same data.

Models

source code for SendGrid’s addContent()
helper functions for custom Mailer class.
SendGrid’s addPersonalization() — this is responsible for managing unique data to specific email addresses when sending a single email to multiple addresses
SendGrid’s addTo() — this is used to add each recipient’s email address to their own Personalization object.
SendGrid’s setTrackingSettings() — this tracks user interaction. These statistics are available to the client on the SendGrid dashboard.
The final API request made to SendGrid’s API.

API Testing

My successful test email #schittscreek

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store