13 Populate The Database And Test
To populate the database you can use the MySQL shell:
mysql -u root -p
At least you have to create entries in the tables domains and users:
INSERT INTO `domains` (`domain`) VALUES ('example.com');
INSERT INTO `users` (`email`, `password`, `quota`) VALUES ('email@example.com', 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 ('firstname.lastname@example.org', 'email@example.com');
INSERT INTO `transport` (`domain`, `transport`) VALUES ('example.com', 'smtp:mail.example.com');
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 http://192.168.0.100/phpmyadmin/ or http://server1.example.com/phpmyadmin/) 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:
||Redirects emails for firstname.lastname@example.org to email@example.com
||Creates a Catch-All account for firstname.lastname@example.org. All emails to example.com will arrive at email@example.com, except those that exist in the users table (i.e., if firstname.lastname@example.org exists in the users table, mails to email@example.com will still arrive at firstname.lastname@example.org).
||This redirects all emails to example.com to the same user at anotherdomain.tld. E.g., emails to email@example.com will be forwarded to firstname.lastname@example.org.
||Forward emails for email@example.com 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:
||Delivers emails for example.com locally. This is as if this record would not exist in this table at all.
||Delivers all emails for example.com via smtp to the server mail.anotherdomain.com.
||Delivers all emails for example.com via smtp to the server mail.anotherdomain.com, 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.
||Mail for any subdomain of example.com is delivered to mail.anotherdomain.tld.
||All emails are delivered to mail.anotherdomain.tld.
||Emails for firstname.lastname@example.org are delivered to mail.anotherdomain.tld.
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
after you have made your changes in the transport table.