Alf
Alf
CDCloudflare Developers
Created by Alf on 8/20/2024 in #workers-help
emailing people from domain workers
No description
10 replies
CDCloudflare Developers
Created by Alf on 8/14/2024 in #workers-help
How can someone fix this sending subject to discord webhook!
can someone help me fix export default { async email(message, env, ctx) { switch (message.from) { case "[email protected]": const webhookUrl = 'discord.com/api/webhooks/124790903927/webhookstuff' try { const response = await fetch(webhookUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ content: message.headers.get('Subject') }) }); // Handle the response if needed (e.g., check for success) } catch (error) { console.error("Error sending webhook:", error); // Optionally, handle the error gracefully (e.g., retry or notify) } break; // Important to keep this break statement default: message.setReject("Unknown address"); } } }
173 replies