Replacing character in receiver address

mvtab

New Member
Jul 11, 2024
15
2
3
We have a complicated situation where we want to check if receivers of incoming E-Mails have a certain character in the address, and if yes, replace it with another character.

So far we made a custom What Object, that solves the first part of the problem: it detects the certain symbol in the field "To" with a regex. Next step we tried to solve over a custom Action Object - Header Attribute, but will not work, because it does not allow us to replace a character in the field, but only to add a whole field.

So everything packed together:
Let's say an E-Mail comes for `string&string@example.com`. We want to:
1. Detect all '&'s. Done by custom What Object with example regex `.*\&.*`.
2. Replace `To` Header with `string#string@example.com`, via any means possible.

Do you have any experience with such use cases? How could we achieve this? We can also use bash, perl, php, python, ruby, java, C if needed, or anything else really. Important is just that the solution is also maintainable, for example easy to do again after updates.

Also completely other type of suggestions are welcome, such as using the underlying Postfix for this or even implementing another Relay in the middle. Our current Mail Server can not handle this.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!