Postfix Basic Configuration
As with most of the server software documented here, Postfix has an intimidatingly large number of options and features. But, as we've already seen with BIND DNS Server and Apache Webserver, even complex software can be easy and quick to setup if you know just what to do to get started. Postfix is no different. At the end of this short section you'll have a fully functioning mail server, capable of sending and receiving mail on behalf of one or more domains.
In most environments, only three configuration details are needed to begin providing mail service with Postfix. First, browse the the General Options page of the module. The top two options, What domain to use in outbound mail and What domains to receive mail for, need to be configured to suit your environment.
For the first option, you will likely want to select Use domainname in order to select the domain name of your server as the source of email sent from it. For example, if my mail server is named
mail.virtualmin.com and I selected this option, mail will appear to originate from virtualmin.com.
The second option specifies the domains for which you will receive email. The default is probably too restrictive in that it will only permit receipt of mail to $mydomainname and localhost.$mydomain, or the server itself. While this depends on your environment and needs, it is likely that you will want to at least add the $mydomain variable to the list of accepted domains.
The last step to making Postfix fully functional for sending and receiving mail is to insure the Local networks parameter is set appropriately. If you only have one network block, this will already be set appropriately, as the default is to accept mail for delivery from all attached networks (i.e., all configured and active network addresses). However, if you have a public and private network interface, you'll likely want to remove the public interface to prevent other clients of your ISP from being able to relay mail through your server.
Click the Save and Apply button to make your changes take effect. It is, of course, a good idea to test your changes to make sure things are working as intended. First, assuming an appropriate DNS MX record has already been configured as discussed in the BIND tutorials, you can send yourself an email at the new domain. Watch the maillog in the System Logs module for errors and to see if the message is delivered as expected. Next configure your mail client to send through your new mail server, to insure it is working for sending mail, as well. The maillog will likely give clues about what is wrong in the event of problems.
If postfix has to work together with some other mail interface like Dovecot IMAP/POP3 Server you have to make sure that both interfaces use the same mail homedir type. Select local delivery and choose the appropriate mail directory type using Home-relative pathname of user mailbox file: