I am currently working with the following setup in order to ensure that only designated users within a domain mydomain.com
will receive emails during testing:
- I have created within hMail a domain test.mydomain.com. For that domain, a catch-all address like firstname.lastname@example.org is defined.
- For each user which shall receive emails, I have created an account email@example.com for which forwarding to firstname.lastname@example.org is enabled (this is also configured for email@example.com).
- For the "OnAcceptMessage" event I have created a script that replaces all recipients from mydomain.com with the equivalent recipients in test.mydomain.com.
This allows me to define on a per-user level, which user shall receive emails. The drawback is that the "To" and "CC" headers of the original email message are destroyed.
However, as suggested I would like to use routes since it would be more intuitive to define the allowed users there. Unfortunately, I found no way to catch all emails sent to users not
listed in the addresses section of the route and route them to a catch-all address. Does anybody know a way to accomplish this?