rewriting incoming mail header

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rewriting incoming mail header

Matt Zagrabelny
Greetings Postfix Users,

I have a need to rewrite part of the incoming mail header before local delivery.

The "To:" header looks like:

To: The default queue via RT <[hidden email]>

and I need to remove the descriptive part of the email address so that it looks like:


Sometimes the header will have arbitrary data, so I would need to match something like:

To: .*?<[hidden email]>$

I'm running version 2.9.6.

Does anyone have any pointers for me for rewriting the headers?

Thanks,

-m
Reply | Threaded
Open this post in threaded view
|

Re: rewriting incoming mail header

Wietse Venema
Matt Zagrabelny:

> Greetings Postfix Users,
>
> I have a need to rewrite part of the incoming mail header before local
> delivery.
>
> The "To:" header looks like:
>
> To: The default queue via RT <[hidden email]>
>
> and I need to remove the descriptive part of the email address so that it
> looks like:
>
> To: <[hidden email]>
>
> Sometimes the header will have arbitrary data, so I would need to match
> something like:
>
> To: .*?<[hidden email]>$
>
> I'm running version 2.9.6.
>
> Does anyone have any pointers for me for rewriting the headers?

See the REPLACE action in:

$ man header_checks
http://www.postfix.org/header_checks.5.html

For capture syntax with () see:

$ man regexp_table
http://www.postfix.org/regexp_table.5.html

$man pcre_table
http://www.postfix.org/pcre_table.5.html

        Wietse