Last active
March 17, 2021 14:53
-
-
Save shammelburg/1e844b7224701e51940f361550c612b9 to your computer and use it in GitHub Desktop.
SendGrid Inbound Parse with Express
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const multer = require('multer') | |
const app = express() | |
const upload = multer() | |
app.post('/api/parse', upload.any(), async (req, res) => { | |
const body = req.body | |
console.log("dkim: ", body.dkim); | |
console.log("to: ", body.to); | |
console.log("cc: ", body.cc); | |
console.log("from: ", body.from); | |
console.log("subject: ", body.subject); | |
console.log("sender_ip: ", body.sender_ip); | |
console.log("spam_report: ", body.spam_report); | |
console.log("envelope: ", body.envelope); | |
console.log("charsets: ", body.charsets); | |
console.log("SPF: ", body.SPF); | |
console.log("spam_score: ", body.spam_score); | |
if (req.files.length > 0) { | |
// Log file data | |
console.log(req.files) | |
} else { | |
console.log('No files...') | |
} | |
return res.status(200).send() | |
}) | |
app.listen(3000, () => { | |
console.log('Webserver running on -> http://localhost:3000') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment