We query an LDAP for identifying aliases and users on a Postfix server.

Due to company-related reasons, some email adresses have the format "SMTP:user@host.com". To forward mail to this user, we would need to cut off the "SMTP:" in front of it.

One solution could be using regex, but we already use the ldap module and I could not find out how to use both together, e.g. querying an ldap and modify the result by using a regex.

How can this be done?


You can simply use your regexp in your rewrite rule. For example:

virtual_alias_maps =

And set up /etc/postfix/myrewrites :

/^SMTP:(.*)$/     ${1}

or similar.

Postfix will rewrite your rewritten address just like in /etc/aliases (think about postmaster: root and after that root: admin@mysite.com).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.