Saturday, May 8, 2010

How to configure alias, forwarder, virtual domain etc in Qmail?

Take some parameters :

Server :
Local domain :
Remote domain : or
IP : Remote IP : or
A/c :
A/c :

1. Forwarding e-mail to another host :
a. Go to /var/qmail/control directory.
b. Put entries in /var/qmail/control/rcpthosts like:
c. Now go to /var/qmail/control/smtproutes and put or //will forward to remote server.
d. Or : or : //Port mentioned.

2. Users and alias users :-

Qmail uses a different method of handling users and aliases than do other SMTP servers, such as sendmail. In sendmail, all system aliases are defined in the /etc/aliases file. In Qmail, these aliases are defined in "dot-qmail" files, which are found in the /var/qmail/alias directory for system-wide aliases or in the user's home directory for user-specific aliases.

So, here are the steps :
a. cd /var/qmail/alias
touch .qmail-test123
b. Put the following line in that hidden file.
& or like this. Just for e-mail forwarding.
c. To forward e-mail to local users, you could inject the e-mail directly into a mailbox file or a maildir directory. Inside .qmail-test, type this line:

/var/qmail/mailnames/ //for mailbox
/var/qmail/mailnames/ //for maildir

3. Mailing list :
a. Create a/c like
b. Create .dot file like : .qmail-list in /var/qmail/alias
c. Put all the e-mail addresses in this file like :

4. Aliases that run programs :
First, you must define the alias file in the same way that you would for forwarding e-mail to another address, mailbox, or maildir. Use a pipe (|) to begin the command line of the program that you want to call. For example, e-mail to must run the program /usr/bin/myprogram. So, create the /var/qmail/alias/.qmail-auto alias file and include the following line in this file:


5. Virtual domains :
The domain has not hosted on but need to its DB record has present and it contains MX records. So, you can setup forwarder. I mean from this domain to any other exist domain.
Qmail also supports virtual domains. If your system ( wishes to accept e-mail for, then add the following line to your /var/qmail/control/rcpthosts file:

Add the domain in /var/qmail/control/virtualdomains file.