export default {
async email(message, env, ctx) {
const subject = message.headers.get("subject") || "(no subject)";
await fetch("https://discord.com/api/webhooks/123/345", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
content: null,
embeds: [
{
title: "New email at hey@milindmishra.com",
fields: [
{ name: "From", value: message.from || "Unknown", inline: false },
{ name: "To", value: message.to || "Unknown", inline: false },
{ name: "Subject", value: subject, inline: false },
],
timestamp: new Date().toISOString(),
},
],
}),
});
await message.forward("milindmishra.work@gmail.com");
},
};