email worker doing the opposite

export default { async email(message, env, ctx) { if (message.headers.get("from").includes("Mark Mateschitz")) { await message.forward("<me>"); } else { message.setReject("Rejected. Sending to this inbox has been banned by your email"); } } } Sent an email from my test account that doesn't include Mark Mateschitz in the from header but it still rejects.
3 Replies
johtso
johtso•2w ago
That's exactly what your code does, rejects the message if it doesn't include that name in the header..
RhinosF1
RhinosF1•2w ago
yes it does i'm in a very warm room and tired and flipped the logic thank you @johtso, fixed because I'm an idiot
johtso
johtso•2w ago
No worries 😅