Received a FetchEvent but we lack a handler for Fe...
# workers-help
p
I have an email worker. export default { async email(message, env, ctx) { const block = ["test@example.com"] if (block.indexOf(message.headers.get("from")) == -1) { await message.forward("me@domain.co.uk"); } else { message.setReject("Address is blocked"); } } } It seems to work but it says all runs have failed and I get the error Uncaught (in response) Error: Handler does not export a fetch() function.
w
Email handlers only fire on new mail in. You can't trigger them with a HTTP request The code wouldn't work though, change that .indexOf to a .includes
p
Thanks I will change that .indexOf to a .includes BTW that was in the samlpe code