Configuration of PostFix as Free Mail Server for Linux
After you have downloaded and installed Postfix or just checked that it is already installed for you, the next task is to configure it as a free mail server for Linux. Most of the configuration of Postfix is done from two files – main.cf and master.cf (both located in /etc/postfix). There are many options you can configure for a Postfix free mail server for Linux and if you want to read about all of them in detail, Postfix docs are a great source of information.
However, if you don't have the time to read the complete configuration guide, here are some brief notes how to configure the basic functionality of a Postfix free mail server for Linux – i.e. receive, send, and notify:
1. Set the domain name used in outbound emails.
In the main.cf configuration file, give the myorigin parameter the value for the domain to use, preceding the name with the dollar sign i.e.:
myorigin = $mydomain
2. Set the domain name for which to receive inbound mails.
A mail server receives a lot of emails and some of them are forwarded to another mail server. If the recipient isn't in the domain, many emails (these for recipients in the domain) are retained. Here is how to configure which emails to retain:
In the main.cf configuration file, specify the local domain(s). The default setting is:
mydestination = $myhostname localhost.$mydomain localhost
This setting should work for most cases when you need a simple free mail server for Linux. If you want to set up a domain-wide mail server, add $mydomain, so that the line reads the following:
mydestination = $myhostname localhost.$mydomain localhost $mydomain
If you want to go beyond the basic functionality of a mail server, you can also send relaying and delivery methods but for a simple installation, send and receive are usually enough. Instead, it makes sense to set notifications, as described next.
3. Set Postfix what troubles to report.
First go to the aliases table (generally it is /etc/aliases but on various systems it differs) and set a postmaster alias – the email address to which notifications about mail delivery problems will be sent.
Next, set the events to be notified about. The default setting in /etc/postfix/main.cf is:
notify_classes = resource, software
which means you will be notified only about serious problems.
If you want a more detailed notification, you can also use the bounce, 2bounce, delay, policy, and protocol classes. For the exact meaning of these classes, check Postfix documentation.