// index.js import express from "express"; import fetch from "node-fetch"; import { simpleParser } from "mailparser"; const app = express(); const PORT = 3334; app.get("/", async (req, res) => { try { const response = await fetch("http://localhost:4566/_aws/ses"); if (!response.ok) { throw new Error("Network response was not ok"); } const data = await response.json(); const messagesHtml = await parseMessages(data.messages); res.send(renderHtml(messagesHtml)); } catch (error) { console.error("Error fetching messages:", error); res.status(500).send("Error fetching messages"); } }); async function parseMessages(messages) { const parsedMessages = await Promise.all( messages.map(async (message, index) => { try { const parsed = await simpleParser(message.RawData); return `