Once your new e-mail server has Courier-IMAP set up and running and you have a
MySQL database to authenticate users, then you are well on your way to being
finished with the project. But there are still a number of items you need to
complete before your e-mail server is ready for prime time. For example, you’ll
still need to configure Postfix to deliver mail to the correct mailbox, add the
actual user accounts, and set up DNS entries to point to the new server. By the
end of this article, your e-mail server should be fully functional.Read the previous installments in this series
Catch up on the creation of this e-mail setup by checking out these articles:
- “Set up a basic e-mail server with Postfix as the MTA”
- “Extend the reach of users’ e-mail with IMAP”
Local delivery agents
Postfix comes with two local delivery agents (LDAs): local and virtual. The local LDA is used to deliver mail to UNIX user accounts. The virtual LDA doesn't care about UNIX users—it delivers to a mailbox in a designated location using any designated user ID (UID) and group ID (GID). You can configure Postfix to use different LDAs for different domains and even specify an LDA for specific e-mail accounts. You can use Procmail as an LDA, allowing you to apply all kinds of custom rules. But for now, I'm going to show you how to configure Postfix's virtual LDA to use MySQL to get its account information.
Configure Postfix to use MySQL virtual accounts
To get Postfix to use the same MySQL database to deliver to virtual accounts, you need to create three configuration files that map e-mail addresses to values. Each of these files contains the connection information for your MySQL server, the column that represents the e-mail address, and the column containing the result. I need one for the Delivery location, one for the UID, and one for the GID. The three code samples in these three sidebar links are examples of these connection files—create them with appropriate values for your installation. You can name them whatever you wish, but they must be owned by root and in a location where Postfix can read them.
The next task is to edit /etc/postfix/main.cf so the virtual delivery agent can use the values in the MySQL database to deliver mail. Table A lists the settings that should be changed.
Table A
|
After making these configuration file changes, reload Postfix by typing:
# postfix reload
Next, check the mail log for errors. If you don't see any errors, Postfix should be using MySQL correctly to recognize incoming mail. Now you need to configure the operating system to support these user accounts.


















There are currently no comments for this post.