I am setting up a postfix email gateway. It will not hold any mail but will accept email for my domain and forward it to another internal mailserver and relay mail out from the internal server.
One of the main problems is that I am working on a live running system and this will be an upgrade so I am using a test domain which I will change at some point to the real domain.
I tried various methods but found the simplest way (that worked) was to use a script to create an aliases file (from ldap entries). There are various problems with this method. The main one being that the entries can't be of the simple form [email protected] because the gateway doesn't know where to send them. They have to be of the form: [email protected].
What I would like doesn't seem hard but I can't get my head around the postfix documentation. There seem to be various ways but none of them seem to work. Most of the examples I have found on the web assume the mail is going to end up on the server. I want a list of users somewhere, preferably of the form: user1, user2, etc rather than [email protected] (I can easily generate this list) and I would like postfix to forward all email to example.com to a particular server: ie realmailserver.example.com.
Can anyone suggest clues as to how I might do this?
You should setup postfix as a backup MX:
http://www.howtoforge.com/postfix_backup_mx
Postfix can also use LDAP queries for recipient verification but a script to create aliases file should do the job very well too.
Then you have to tell it where to send them.
Relevant documentation: http://www.postfix.org/transport.5.html
This accepts entries of the form:
Where nexthop-destination can be your internal mailstore IP.