# Postfix - autoforwarding of all messages to another server



## ph0enix (Sep 17, 2009)

Hi,
I'm trying to set up a "hot standby" server for a Postfix system that doesn't send e-mail (only receives).  I would like to forward all messages coming to the main server to another machine running postfix (it will be at sitting at a different datacenter).  Ideally, I would like for the headers to remain the same as on the original server.  Can I do this?  If so, how?

Thank you! 

J.


----------



## hansaplast (Sep 18, 2009)

Not sure what you mean here.

Do you just want to backup all incoming mail on another server? Then check the always_bcc option in main.cf. Keep in mind that at the backup server mail is bounced when no (local) user is found. You should redirect (alias) all mail to one or more accounts on the backup server.

If you want a backup mail server that catches all mail when the main server is down. Google: configure postfix as backup MX
O and don't forget to set the right dns entries. An excellent example can be found here.


----------



## Alt (Sep 18, 2009)

Try this parameter
/usr/local/etc/postfix/main.cf


> # The relayhost parameter specifies the default host to send mail to
> # when no entry is matched in the optional transport(5) table. When
> # no relayhost is given, mail is routed directly to the destination.
> 
> relayhost = blahblahblah


----------



## ph0enix (Sep 18, 2009)

hansaplast said:
			
		

> Not sure what you mean here.
> 
> Do you just want to backup all incoming mail on another server? Then check the always_bcc option in main.cf. Keep in mind that at the backup server mail is bounced when no (local) user is found. You should redirect (alias) all mail to one or more accounts on the backup server.
> 
> ...



Yes, I'm trying to keep the mail on both servers in sync. I think the always_bcc setting will do the trick.  The problem with using the second server as a backup is that the mail will only get delivered to the host that's currently up.  

Thank you!


----------



## ph0enix (Sep 18, 2009)

Alt said:
			
		

> Try this parameter
> /usr/local/etc/postfix/main.cf



That will make it deliver only to the realy host - no?  I need the messages to be delivered to both servers.


----------



## Alt (Sep 18, 2009)

Oh i dunno then =)


----------



## ph0enix (Sep 18, 2009)

hansaplast said:
			
		

> Not sure what you mean here.
> 
> Do you just want to backup all incoming mail on another server? Then check the always_bcc option in main.cf. Keep in mind that at the backup server mail is bounced when no (local) user is found. You should redirect (alias) all mail to one or more accounts on the backup server.
> 
> ...



I'm having trouble figuring out how to use the always_bcc setting (can't find any info on it).  Do I just put the backup domain there? ...or does it require an e-mail address with the username as a variable? $user1@seconddomain.com, for example?

Thanks! 

J.


----------



## DutchDaemon (Sep 18, 2009)

BCC is an 'email-userland' type of setting, so it requires an email address, not a hostname. 

I don't know how relevant this information still is, but see if it helps:
http://www.phwinfo.com/forum/mailing-postfix-users/140893-postfix-always_bcc.html


----------

