Thanks for your replies.
Meanwhile i have tested with some simple replacements in header checks.

/email@office/ REPLACE From: Office
/email@hospital/ REPLACE From: Hospital

With the above, the replacement works fine for multiple lines.
Here are the logs:
Apr 28 10:40:10 server postfix/smtpd[48572]: connect from unknown[remote
system IP]
Apr 28 10:40:10 server postfix/smtpd[48572]: 381C760324:
client=unknown[remote system IP]
Apr 28 10:40:10 server postfix/cleanup[48576]: 381C760324:
message-id=<1682671210.212@company>
Apr 28 10:40:10 server postfix/qmgr[48571]: 381C760324: from=<sender@company>,
size=600, nrcpt=1 (queue active)
Apr 28 10:40:10 server postfix/smtpd[48572]: disconnect from unknown[remote
system IP] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 28 10:40:10 server postfix/smtp[48577]: 381C760324: replace: header
Received: from company (unknown [remote system IP])??by hres: From: Office
Apr 28 10:40:10 server postfix/smtp[48577]: 381C760324: replace: header To:
email@office: From: Office
Apr 28 10:40:10 server postfix/smtp[48577]: 381C760324: to=<Group@email>,
orig_to=<email@office>, relay=smtp.company.net[IP]:25, delay=0.25,
delays=0.01/0


Anyway, the final result i want to achieve, is that the Subject will be
filled with the RCPT To header part,like this
/email@office/ REPLACE Subject: Office
/email@hospital/ REPLACE Subject: Hospital

But the replacement is not working. The received emails shows an unmodified
Subject but the RCPT To field is empty.
Apr 28 10:40:10 server postfix/smtpd[48572]: connect from unknown[remote
system IP]
Apr 28 10:40:10 server postfix/smtpd[48572]: 381C760324:
client=unknown[remote system IP]
Apr 28 10:40:10 server postfix/cleanup[48576]: 381C760324:
message-id=<1682671210.212@company>
Apr 28 10:40:10 server postfix/qmgr[48571]: 381C760324: from=<sender@company>,
size=600, nrcpt=1 (queue active)
Apr 28 10:40:10 server postfix/smtpd[48572]: disconnect from unknown[remote
system IP] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
Apr 28 10:40:10 server postfix/smtp[48577]: 381C760324: replace: header
Received: from company (unknown [remote system IP])??by hres: Subject:
Office
Apr 28 10:48:44 hreslb03 postfix/smtp[48602]: 9D1A160324: replace: header
To: email@office: Subject: Office
Apr 28 10:40:10 server postfix/smtp[48577]: 381C760324: to=<Group@email>,
orig_to=<email@office>, relay=smtp.company.net[IP]:25, delay=0.25,
delays=0.01/0

Why are To and From replaced in the header but not the subject?
Am I perhaps missing the right expression here and could someone give me
some advice?
Or is there really no way around Mailmunge or MimeDefang etc.?
Any hints would be appreciated.

Thank you.



Am Mi., 26. Apr. 2023 um 17:25 Uhr schrieb Wietse Venema via Postfix-users <
postfix-users@postfix.org>:

> Wietse Venema via Postfix-users:
> > Andreas Cieslak via Postfix-users:
> > > Hi list,
> > >
> > > i want to achieve that my postfix relay will modify the subject based
> on
> > > the recipients.
> > > The postfiy relay is receiving email from other internal systems and
> > > forwards all mail to a mail group (testgroup) on another internal mail
> > > system.
> >
> > Suggestion: use milter-regex. You can install it from source code,
> > or install as a package for many distributions.
>
> Unfortunately, it looks like milter-regex is good for rejecting
> mail, not for message modification.
>
>         Wietse
> _______________________________________________
> Postfix-users mailing list -- postfix-users@postfix.org
> To unsubscribe send an email to postfix-users-le...@postfix.org
>
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to