Score:0

how to implement pcre command filter and postmap on postfix

cd flag

i am using postfix 3.3.0 i have in main.cf

smtpd_command_filter = pcre:/etc/postfix/command_filter

in comman_filter

/^(RCPT\s+TO:\s*<(.*)@domaina.com>)/  RCPT TO:<[email protected]>

whene querying postmap -q "RCPT TO: <[email protected]>" pcre:/etc/postfix/command_filter it works just fine

output: RCPT TO: <[email protected]>

i have executed postmap /etc/postfix/command_filter and restarted postfix

and still no effect on postfix smtp telnet remote hist and send rcpt command

Maybe I’m missing something.

It has to be done this way not by hash maps redirect domain 
jp flag
Why are you using the [`smtpd_command_filter`](https://www.postfix.org/postconf.5.html#smtpd_command_filter) in the first place? It is *a last-resort tool to work around client commands that break interoperability with the Postfix SMTP server*. There are better options for aliases.
Hichem avatar
cd flag
@EsaJokinen thanks for the advice in fact i don’t want to use maps hash domain redirect because I’m using transport and it’s long story basicly i want to do two transport same domain it has to be done in rcpt command rewrite when postfix’s smtp telnet the remote host and sends rcpt command
jp flag
It still sure sounds like an XY problem.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.