From 84d756dc249703b77540373d6e2dcaba54bc754c Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 23 Mar 2025 12:30:08 +0000 Subject: feat(router): add email event handler to forward messages to a specified address --- source/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/index.js b/source/index.js index e0a6b04..b72fc71 100644 --- a/source/index.js +++ b/source/index.js @@ -85,6 +85,20 @@ export default { return router.route(); }, + + /* + Email event handler, this function will be called whenever an email is sent to the worker. + The function will parse the email message and forward it to a specified email address. + + @param {Message} message - the incoming email message object + @param {Environment} environment - the environment object + @param {Context} context - the context object + + @returns {void} + */ + async email(message, environment, context) { + message.forward("alex@zue.dev"); + }, }; /* -- cgit v1.2.3