[deliver to local Dovecot replica when SMTP is down] Noel Jones: > Maybe use local (split DNS) MX records records to deliver locally > when the remote vpn connection Postfix-B is unavailable. This would > probably require a second local postfix instance to receive the mail > for dovecot since MX records require an SMTP hop. > > Then use a doveadmin command from cron to sync/move any local mail > to the remote B instance periodically. > > Actually, my first thought is if the vpn is frequently down, then > *that's* the problem to fix. Or just keep all the mail on the > cloud-A and access IMAP over the internet.
If the outages are persistent, then it may make sense to temporarily change Postfix configuration. Example 1: This could be manual or automatic. VPN down: Update transport_maps to route the domain to the local Dovecot replica. VPN up: Update transport_maps to route the domain to the cloud server. To update a Berkeley DB transport map safely, see http://www.postfix.org/DATABASE_README.html#safe_db After each map update, "postfix reload" and "postqueue -f". Example 2: This is an 'automatic' solution. Configure a dynamic transport map (transport_maps = socketmap:blah) that responds after checking the VPN status. Problem is, the Postfix transport daemon has a one-element in-memory cache, and if all queries are for the same domain, then it will reply from cache instead of querying the transport map. Wietse