Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have 2 servers (A,B) with email server working. I am trying to replicate all emails sent to server A to server B using transport map. My transport table is

CREATE TABLE `transport` (
    `domain` varchar(128) NOT NULL DEFAULT '',
    `transport` varchar(128) NOT NULL DEFAULT '',
    UNIQUE KEY `domain` (`domain`) 
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

When I add row to that table to transport emails to server B it works

+-------------+----------------+
| domain      | transport      |
+-------------+----------------+
| example.com | smtp:[1.2.3.4] |
+-------------+----------------+

but when I try to add another server it stops working

+-------------+--------------------------------+
| domain      | transport                      |
+-------------+--------------------------------+
| example.com | smtp:[1.2.3.4], smtp:[2.3.4.5] |
+-------------+--------------------------------+

My question is, how to get it working? How can I get mails on two different servers replicated?

share|improve this question
    
If you put a core routing table for postfix in a database like this, what happens when the database is down ? –  adaptr May 16 '12 at 6:36
    
Hi, I am very basic and according to few howto it should be done this way [linux.justinhartman.com/…, do you know different solution for my problem? –  debianek May 16 '12 at 8:26
    
I would strongly advise you not to follow random tutorials you find on the internet; most of them are plain wrong, or bad for general scenarios. Always use the official postfix documentation at postfix.org/documentation.html –  adaptr May 16 '12 at 12:32

1 Answer 1

Transport maps don't support multiple nexthops. You can try using auto_bcc (or one of the BCC maps) to deliver mail to additional addresses.

For example, to deliver all mail destined for example.com to server B, create a domain for the "backup" mail (e.g. backup.example.com) and configure server B to accept mail for this domain. Then use a regular expression recipient_bcc_maps table which adds the counterpart user on backup.example.com as a BCC.

main.cf:

recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc_maps

recipient_bcc_maps:

/^(.*)@example\.com$/   ${1}@backup.example.com
share|improve this answer
    
Hi, thanks for your answer, what I would like to is to have all emails for example.com domain sent to server B and having copy on server A. –  debianek May 15 '12 at 22:20
    
Updated answer with possible solution. –  mgorven May 15 '12 at 22:32
    
If, like me, you're lazy and only want to use one backup domain, add the domain part in the standard manner of ${1}=${2}@backup.example.tld. –  adaptr May 16 '12 at 12:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.