Tony Groves wrote:
> I'm up against a problem with Postfix in that I want to rewrite
> address headers in certain messages but I can't get it to do it the
> way I want.
> An example would be a message sent to an address such as
> "1234567 at fax". I want to have the To header rewritten as
> "1234567<fax at domain.com>" (so that the fax number is preserved for the
> fax server to detect) and the message routed to "fax at domain.com". So,
> in main.cf I add the line:
> canonical_maps = /etc/postfix/canonical_maps
> and in canonical_maps:
> /^(\d+)@fax$/ $1<fax at domain.com>
> and reload Postfix. The result is that the message gets rerouted as
> intended, and a new X-Original-To header is added showing the original
> address, _but_ the To header ends up with just "fax at domain.com",
> losing the fax number.
> Can any Postfix expert out there tell me how I can get this working,
Colm Buckley wrote:
> I suggest you use fax+number at domain.com - that way you don't have to
> worry about the address and comment parts of the To: line being
> separated. If the domain.com mail receivers accept + as a delimiter
> (as many do), fax+anything at domain.com will be treated the same as
> fax at domain.com.
Paolo Marchiori wrote:
> May I suggest a completely different approach, using
> fax+1234567 at domain.com so that the fax number remains encoded in the
> address and doesn't get removed by any step on its way to the fax
Thanks for those tips!
Just a small change to the regex and I'm in business:
/^(\d+)@fax$/ fax+$1 at domain.com
I haven't tested it with the fax server (still RelayFax on Windows) yet,
but it looks like it should work.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!