-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
48 lines (40 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
const rawFullMimeMessageChecked = false
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);
// Logs properties
if (rawFullMimeMessageChecked) {
console.log("email: ", body.email);
} else {
console.log("headers: ", body.headers);
console.log("html: ", body.html);
console.log("text: ", body.text);
console.log("attachments: ", body.attachments);
console.log("attachment-info: ", body['attachment-info']);
console.log("content-ids: ", body['content-ids']);
}
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 port 3000! -> http://localhost:3000')
})