Postfix Configuration
The following explanation is a step-by-step instruction on the sections that you need to modify in main.cf
Postfix offers a nice feature called SOFT BOUNCE, this feature can be used when you are working on an already setup mail server. When this feature is active the server will still queue messages during testing time.
Domain for Outbound mail
Sending Mail
Because we are using a domain name, uncomment the following line, and read ahead to create an alias database.
myorigin = $mydomain
Domain for Inbound
Receive mail
Do not enable any interface, instead create a file called destination in /etc/postfix/destination and place the domain-name for the destination in that file. In the RECEIVING MAIL section, find the line:
mydestination = $myhostname, localhost.$mydomain,
Edit this line to point to the destination file:
mydestination =$myhostname,localhost.$mydomain, /etc/postfix/mydestination
Next edit the mydestination file and enter your domain-name(s):
[root@server2 postfix]# vi mydestination
netcontrol.org
onetraining.net
Create the Aliases
In the ALIAS DATABASE SECTION, uncomment the line:
Alias_maps = hash:/etc/postfix/aliases
Next execute the following command to create the database. Note that the database will be created in the directory /etc/postfix/
[root@server2 postfix]# postalias /etc/postfix/aliases
That's it. Restart postfix. You now should be able to send and receive email from your domain name.
Virtual Domains with Postfix
We have successfully configured the email server to send and receive email at the default domain (Primary domain), in this case netcontrol.org. All users in the system can send and receive email under netcontrol.org by default. If you already updated mydestination file and included other domains; that is not enough for virtual mail servers.
Since onetraining.net is a virtual domain in this example, I will use it to set the mail server in the virtual domains.
Configuring the virtual domain email server
Virtual Address Mapping
We need to go back and edit the main.cf file to set this virtual address. All users in each domain have to be able to receive and send email. And of course it has to get to its right destination.
To implement this, locate and insert:
# ADDRESS REDIRECTION (VIRTUAL DOMAIN)
# Insert text from sample-virtual.cf if you #need virtual domain support.
virtual_maps = hash:/etc/postfix/virtual_maps
Note that virtual_maps is hashed just like aliases, the next step is to create a file in /etc/postfix. Call it virtual_maps and include the virtual domains in it.
[root@server2 postfix]# vi virtual_maps
onetraining.net DOMAIN
velasco@onetraining.net velasco
In this file you will place all your users for the virtual domains, and after editing this file you have to create the database virtual_maps.db
At your command line (console) type the following:
[root@server2 postfix]# postmap virtual_maps < virtual_maps
Restart postfix and you are ready to go. Test the system with your user under the virtual domain, you should be able to receive and send email.
|