Skip to content

Instantly share code, notes, and snippets.

View kaelansmith's full-sized avatar

Kaelan Smith kaelansmith

View GitHub Profile
@kaelansmith
kaelansmith / email.js
Last active November 15, 2022 20:25
NextJS + Mailjet Integration
// Notes:
// - this file needs to live in the NextJS pages/api/ folder
// - you'll need to install the 'node-mailjet' NPM package and add + change the environment variables seen below (MailJet onboarding process gives you this info)
export default function handler(req, res) {
const form = req.body
if (!form || !form.email || !form.phone)
return res.status(400).json({ message: 'The form was not filled out properly.', error: 400 })
const Mailjet = require('node-mailjet')