On 9/4/2018 11:42 AM, B. Reino wrote: > Hello, > > I currently host three virtual domains with a postfix instance. > Delivery is, for all accounts, to a (local, using unix socket) > dovecot server using LMTP. > > For one of those virtual domains I'd like to have a separate > (remote) dovecot server, while keeping the SMTP (postfix) at the > current server. > > Thus I'd need something like: > virtual_transport = lmtp:[hostname]:port > (if recipient is in the now-external domain) > (using [] to deliver via lmtp to hostname directly) > > virtual_transport = lmtp:unix:private/dovecot-lmtp > (otherwise) > > I believe the correct way to do this is defining the default virtual > transport with > virtual_transport = lmtp:unix:private/dovecot-lmtp > > and then: > transport_maps = hash:/etc/postfix/virtual_transport > > having in /etc/postfix/virtual_transport > external.domain lmtp:[hostname]:port > > Q1) does the above make sense? > i.e. will it work as intended (as explained above), so that e.g. if > the (valid, as otherwise rejected) recipient domain is not found in > the hash table then the (default) virtual_transport will be used? > > (otherwise, and assuming the above would work, I could just define > the remaining domains also in the table, but I'd prefer keeping it > as generic as possible). > > Q2) would it also be possible to -- during a testing period -- have > TWO virtual_transports for a single virtual domain? > > This way I could deliver via LMTP to the existing server (via unix > socket) as well as to the new remote server (lmtp via inet). > > Thanks a lot in advance for any replies or clarifications!
To override the transport for a single recipient, use a transport_maps entry with the recipient address as the key. No change needed for the existing virtual_transport. something like: # /path/to/transport_file [email protected] lmtp:[someotherhost]:port # main.cf transport_maps = hash:/path/to/transport_file === Delivering one mail to multiple servers is more complicated. Add a virtual_alias_maps entry to add a second recipient for the message, then deliver the second recipient to the alternate server. If necessary, you can use lmtp_generic_maps to rewrite the recipient back to the original name during delivery. # virtual_alias [email protected] [email protected] [email protected] # transport [email protected] lmtp:[other.example.com]:port # lmtp_generic other.example.com example.com # main.cf virtual_alias_maps = hash:/path/to/virtual_alias transport_maps = hash:/path/to/transport lmtp_generic_maps = hash:/path/to/lmtp_generic -- Noel Jones
