How can I add 'postfix-pcre' to mail container

NethServer Version: 8
Module: mail
Hello,
I’m referring to my own question How to add header with bcc recipient
I am a step further now, in my testinstallation i successfully inserted check_recipient_access pcre:/etc/postfix/x-add-envelope-to into smtpd_recipient_restrictions but the log says:

smtpd_recipient_restrictions = [original],check_recipient_access pcre:/etc/postfix/x-add-envelope-to,
warning: pcre:/etc/postfix/x-add-envelope-to is unavailable. unsupported dictionary type: pcre
warning: pcre:/etc/postfix/x-add-envelope-to lookup error for "test1@test1.de"

postconf -m does not show pcre

runagent -m mail1 podman exec -it postfix postconf -m
cidr environ fail inline internal ldap lmdb memcache pipemap proxy
randmap regexp socketmap sqlite static tcp texthash unionmap unix

On the cluster host there is postfix-pcre available but how do I install it inside the container? (I know it will not survive a container update)

yum search pcre
postfix-pcre.x86_64 : Postfix PCRE map support

Regards
Uwe

The pcre lookup table is not installed in the container, but you can try regexp as alternative. I expect they have similar features.

See Postfix manual - regexp_table(5)

1 Like

Thank you, this seems to work

I just replaced “pcre:” by “regexp:”

edit files:
runagent -m mail1 podman exec -it postfix vi /etc/postfix/main.cf.d/x-add-envelope-to

// etc/postfix/main.cf.d/x-add-envelope-to.cf
// copy smtpd_recipient_restrictions from original config 
// and add line with my file to add header
// my file in custom config dir too so it's not inside the container
runagent -m mail1 podman exec -it postfix vi /etc/postfix/main.cf.d/x-add-envelope-to.cf
smtpd_recipient_restrictions =
  reject_non_fqdn_recipient,
  check_recipient_access inline:{ mydomain.de=reject_unverified_recipient },
  check_recipient_access regexp:/etc/postfix/main.cf.d/x-add-envelope-to,

// /etc/postfix/main.cf.d/x-add-envelope-to
# /etc/postfix/main.cf.d/x-add-envelope-to
# write envelope address  in additional header
/(.+)/  prepend X-Envelope-To: $1

Now I get X-Envelope-To header for our mail-archive to sort messages to their owners.
Uwe

1 Like