I think it would be quite simple to achieve.
Sketch of implementation architecture
For example you configure your SMTP server so that any addresses matching a certain format (e.g. mailhook-<UUID>@mydomain.com
where <UUID>
is some randomly generated alphanumeric string) would be forwarded via a simple script to a helper service listening on a particular TCP port, and then that service would examine the recipient address and figure out which workflow to trigger.
I asked Gemini AI how to do this in postfix and the answer was pretty straightforward: https://g.co/gemini/share/cfdcda400c5e. Of course LLMs hallucinate so it might not be 100% correct, but based on what I know about postfix it looks reasonably plausible.
Really the only tricky bit is the routing of incoming email to the correct workflow. n8n would need to keep track of the mapping, e.g.
[email protected]
triggers workflow A[email protected]
triggers workflow B
and so on.
A possible no-code mockup
In fact, I’m guessing all of this could probably be achieved even without writing any code:
Email → SMTP server → forwarding script → webhook triggering a router workflow → Execute Workflow Trigger runs the desired final destination workflow
In more detail:
- Any mail sent to
mailhook-<UUID>@mydomain.com
is forwarded via a simple script to an n8n webhook. - That webhook triggers a router workflow which figures out from the recipient address which destination workflow the email is intended for, and uses an Execute Workflow node to forward the email’s data to the desired workflow.
- The desired workflow is triggered via an Execute Workflow Trigger.
I’m brand new to n8n so I might have messed up some details, but hopefully the general idea is sound.
The value of implementing a new mailhook node
The main value of adding a new mailhook node to n8n would be to eliminate the need for the user to set up step 2 in the above no-code approach, since n8n would itself know how to handle the routing to the correct workflow based on the address the email was sent to.