Discussion:
Stripping TLD from env rcpt and To-header
(too old to reply)
Vesa-Matti Kari
2020-11-05 14:40:04 UTC
Permalink
Hello!

I am new to Postfix, so sorry if this question is quite
elementary. Is it possible to strip off top level domain
from envelope recipient and To-header?

For example:

***@example.com.s -> ***@example.com
***@gmail.com.s -> ***@gmail.com

Thanks for any help.

Best regards,
vmk
--
************************************************************************
Tietotekniikkakeskus / Helsingin yliopisto
IT department / University of Helsinki
************************************************************************
Vesa-Matti Kari
2020-11-05 14:53:52 UTC
Permalink
Post by Vesa-Matti Kari
Is it possible to strip off top level domain
from envelope recipient and To-header?
Ah, I got it working almost immediately after posting
my question. In main.cf, I have:

canonical_maps = regexp:/etc/postfix/rewrite

and rewrite has simply:

/^(.*)@(.*)\.s$/ ${1}@${2}

Seems to work fine.

Best regards,
vmk
--
************************************************************************
Tietotekniikkakeskus / Helsingin yliopisto
IT department / University of Helsinki
************************************************************************
Loading...