addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
let respContent = "";
method: "POST",
body: JSON.stringify({
subject: "Email - Always and Forever",
content: "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication.",
askReceipt : "yes"
}),
});
if( request.method == "POST" ) {
const resp = await fetch(send_request);
const respText = await resp.text();
respContent = resp.status + " " + resp.statusText + "\n\n" + respText;
}
let htmlContent = "<html><head></head><body><pre>" +
'</pre><p>Click to send message: <form method="post"><input type="submit" value="Send"/></form></p>' +
"<pre>" + respContent + "</pre>" +
"</body></html>";
return new Response(htmlContent, {
headers: { "content-type": "text/html" },
})
}