Discussion:
Add subject prefix to subject based on reply-to/sender email address
(too old to reply)
d***@gmail.com
2015-09-22 09:30:06 UTC
Permalink
Hi all
Basically Ive been searching for straight answer on this via google search, run dry...

For my staff, we want to add a prefix to subject, as example "[M] Sender Subject" where was originally "Sender Subject" and only when a specific reply-to or sender address is specified.

This would be used to centrally add to genuine marketing emails a "[M]" to the subject so the end users can add a mail rule looking for [M] if they so choose to filter marketing items (this isnt junk filtering, subscribed and popular items only that are consistent - mail clients outlook, thunderbird, webmail, whatever is used)

Could then also do the same routine for Social media items with a [S] prefixed to subject line.

Anyone got this working via PCRE in postfix header_checks?

Regards, Luke
d***@gmail.com
2016-01-16 14:27:10 UTC
Permalink
Hi

The Subject field which is part of the mail header is manage by the sender machine (the MUA) and can not be certified. Postfix (the MTA) should not modify this header.

In practice you can modify the subject using a postfix filter which will call an external application (a bash script or a binary one).
http://www.postfix.org/FILTER_README.html

Be award of subject encoding, you can't just add "[M]" you may have to encode the subject in base 64 or Quote Printable if the original subject contains non ascii characters. See https://www.ietf.org/rfc/rfc2047.txt for more information.


Regards

Victor d'Agostino
Post by d***@gmail.com
Hi all
Basically Ive been searching for straight answer on this via google search, run dry...
For my staff, we want to add a prefix to subject, as example "[M] Sender Subject" where was originally "Sender Subject" and only when a specific reply-to or sender address is specified.
This would be used to centrally add to genuine marketing emails a "[M]" to the subject so the end users can add a mail rule looking for [M] if they so choose to filter marketing items (this isnt junk filtering, subscribed and popular items only that are consistent - mail clients outlook, thunderbird, webmail, whatever is used)
Could then also do the same routine for Social media items with a [S] prefixed to subject line.
Anyone got this working via PCRE in postfix header_checks?
Regards, Luke
Loading...