Marc SCHAEFER wrote:
Hi,

I would like to configure a bizarre setup like this:

   if the mail is sent as usual, do not use a smart-host, just
   deliver (that is easy and works)

   if the recipient domain ends in ".through-smart-host", it should
   deliver via a SMTP relay (smart-host). Of course, just before
   delivering, it should remove the ".through-smart-host" suffix.

Something like this could be interesting:

   s/^(.+)\.through-smart-host$/$1/ smtp:[smart-host]

However I didn't figure out how to implement this using pcre_table(1).

If all fails, I could create a new UNIX mailer in master.cf and route
through it, and make it deliver the mail (e.g. through a nullmailer
or something) after changing the destination with a Perl script,
but that would be complicated, slow and clumsy.

Does anyone have any suggestion ?  (basically, what I want is the
obsolete mixed UUCP/domain routing, such as [EMAIL PROTECTED],
but that doesn't usually work anymore nowadays)

Yes, you should be able to do this with a transport_maps entry and a regexp (or pcre) smtp_generic_maps.

# main.cf
transport_maps = hash:/etc/postfix/transport
smtp_generic_maps = regexp:/etc/postfix/generic.regexp

# transport
through-smart-host  smtp:[smart-host]
.through-smart-host  smtp:[smart.host]

# generic.regexp
/^(.*)\.through-smart-host$/   $1

http://www.postfix.org/transport.5.html
http://www.postfix.org/generic.5.html

--
Noel Jones

Reply via email to