Mailer Madness, (React frontend + AWS lambda/SendGrid)

const express = require('express');
const app = express();
const sgMail = require("@sendgrid/mail");
const msg = {
to: "",
from: "",
subject: "heyy, I hope this works dude",
text: "whats up with this guy lolololol",
html: "<strong>the node email works okay hahaha please bro</strong>"
app.get('/', (request, response) => {
response.json({ returnMessage: "check your email!!!" })
  • step 2, make a new lambda function… call it (myEmailFunction) or whatever. Then save your key in Lambdas environment variables (here)…
  • step 3, Locally make a directory, install your dependencies (node and sendgrid), and write your function for sending the email! here is my directory. What you’re going to do is zip this file, give it to lambda and with it goes your dependencies (how to do this here).
$ npm init --y
$ npm i @sendgrid/mail
$ zip -r <nameOfYourZipFile>.zip ./
return {    
headers: {
"Access-Control-Allow-Origin": "http://localhost:3000",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Methods": "OPTIONS,POST"



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
Jack Callaway Sanders

Jack Callaway Sanders

A Fullstack Web Dev-arino, part time ‘cool guy’. My website is