[SOLVED] Replace subject with recipient localpart for one domain

KatyComputer

Well-Known Member
Sep 26, 2019
195
16
58
62
St Louis
katycomputer.com
Can anyone think of a way to do this in a PMG environment, it's not possible using native Postfix:
My Postfix server handles message for a dozen domains, for one of these domains, I want the subject replaced with the recipient's local part, so something like this, but put in a format that Postfix understands:

# domain3.com is the one recipient domain we want affected by this rule
# $recipient_name the recipient localpart, so "joe" if the recipient is joe@domain3.com

IF $recipient_domain = 'domain3.com'

REPLACE $subject WITH $recipient_name

ENDIF

I think I need to setup a smtp_header_checks file, but the more I look at it the harder my head hurts.

Thanks for you help.
 
Last edited:
one thing you could do is create a rule with the domain as TO object and a modify field as action - where your replace the subject by
__TARGETS__: __SUBJECT__

caveat: this does not workas intended if a mail gets sent to 2 addresses in the domain (the subjet would be prefixed by all of the addresses)
caveat2: it does not prepend only the local part but the complete e-mail address

I hope this helps!
 
Check the logs - does the rule get triggered, or is the mail maybe accepted by a rule with a higher priority before?

I just tried replicating this here - and for me it works.

One potential cause could be the to - object - the mail needs to have the Envelop receiver to have a @katyfax.com address (and not one of a subdomain).

I hope this helps!