There is a new revision of this tutorial available for Fedora 18.

Virtual Users And Domains With Postfix, Courier And MySQL (Fedora 8) - Page 5

14 Test Postfix

To see if Postfix is ready for SMTP-AUTH and TLS, run

telnet localhost 25

After you have established the connection to your Postfix mail server type

ehlo localhost

If you see the lines




everything is fine.

[[email protected] sbin]# telnet localhost 25
Connected to localhost.
Escape character is '^]'.
220 ESMTP Postfix
ehlo localhost
250-SIZE 10240000
250 DSN
221 2.0.0 Bye
Connection closed by foreign host.
[[email protected] sbin]#



to return to the system's shell.


15 Populate The Database And Test

To populate the database you can use the MySQL shell:

mysql -u root -p
USE mail;

At least you have to create entries in the tables domains and users:

INSERT INTO `domains` (`domain`) VALUES ('');
INSERT INTO `users` (`email`, `password`, `quota`) VALUES ([email protected]', ENCRYPT('secret'), 10485760);

(Please take care you use the ENCRYPT syntax in the second INSERT statement in order to encrypt the password!)

If you want to make entries in the other two tables, that would look like this:

INSERT INTO `forwardings` (`source`, `destination`) VALUES ([email protected]', [email protected]');
INSERT INTO `transport` (`domain`, `transport`) VALUES ('', '');

To leave the MySQL shell, type


For most people it is easier if they have a graphical front-end to MySQL; therefore you can also use phpMyAdmin (in this example under or to administrate the mail database. Again, when you create a user, go sure that you use the ENCRYPT function to encrypt the password:

I do not think I have to explain the domains and users table further.

The forwardings table can have entries like the following:

source destination  
[email protected] [email protected] Redirects emails for [email protected] to [email protected] [email protected] Creates a Catch-All account for [email protected] All emails to will arrive at [email protected], except those that exist in the users table (i.e., if [email protected] exists in the users table, mails to [email protected] will still arrive at [email protected]). @anotherdomain.tld This redirects all emails to to the same user at anotherdomain.tld. E.g., emails to [email protected] will be forwarded to [email protected]
[email protected] [email protected], [email protected] Forward emails for [email protected] to two or more email addresses. All listed email addresses under destination receive a copy of the email.

The transport table can have entries like these:

domain transport : Delivers emails for locally. This is as if this record would not exist in this table at all. smtp:mail.anotherdomain.tld Delivers all emails for via smtp to the server smtp:mail.anotherdomain.tld:2025 Delivers all emails for via smtp to the server, but on port 2025, not 25 which is the default port for smtp.


The square brackets prevent Postfix from doing lookups of the MX DNS record for the address in square brackets. Makes sense for IP addresses. smtp:mail.anotherdomain.tld Mail for any subdomain of is delivered to mail.anotherdomain.tld.
* smtp:mail.anotherdomain.tld All emails are delivered to mail.anotherdomain.tld.
[email protected] smtp:mail.anotherdomain.tld Emails for [email protected] are delivered to mail.anotherdomain.tld.


man transport

for more details.

Please keep in mind that the order of entries in the transport table is important! The entries will be followed from the top to the bottom.

Important: Postfix uses a caching mechanism for the transports, therefore it might take a while until you changes in the transport table take effect. If you want them to take effect immediately, run

postfix reload

after you have made your changes in the transport table.


16 References

Tutorial: ISP-style Email Service with Debian-Sarge and Postfix 2.1:

Postfix + Quota:

Mail Passwords Encrypted using saslauthd:


Share this page:

1 Comment(s)

Add comment


From: LifePoisons

I can't tell you how much I appreciate this guide.  You are a fine human being.  I ran into an issue at the last step with testing out utilizing "telnet localhost 25".  I'd connect then just hang.  Upon inspection of my /var/log/mailog I was getting an error stating:

fatal: unsupported dictionary type: mysql

Upon running "postconf -m" I realized that the mysql update never even took so no wonder it was unsupported.  I reviewed the  patch process and was getting "xxx file conflicts with previous install of xxxx" when I tried to rpm that beast up.  I followed the wisdom of another fella stating that I needed to update the "Release 2" line in the postfix.spec then rebuild and rerun.  Still no luck...fewer conflict listings but still no support.  After several other pathetic attempts on my part, I just gave up and used the "rpm --force -ivh" flag.  I'm sure this is gonna wreak havoc on my soul in the future for something but for those of you in a pickle just know that it was the only way my baby would cooperate.  Just wanted to help this possibly not happen to someone else.  Hopefully you can find a more intelligent way to solve it.  This was the quick and dirty.  Happy mailing.