Saturday, May 8, 2010

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

Take some parameters :

Server : titanic_mail.com
Local domain : disco.com
Remote domain : gmail.com or ureka.com
IP : Remote IP : 209.85.231.83 or 82.98.86.164
A/c : test123@disco.com
A/c : testremote@ureka.com

1. Forwarding e-mail to another host :
a. Go to /var/qmail/control directory.
b. Put entries in /var/qmail/control/rcpthosts like: disco.com
c. Now go to /var/qmail/control/smtproutes and put
disco.com:gmail.com or disco.com :ureka.com //will forward to remote server.
d. Or disco.com : 209.85.231.83 or disco.com : 209.85.231.83:1027 //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.
&testremote@ureka.com or @test@disco.com 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/disco.com/test/Mailbox.test //for mailbox
/var/qmail/mailnames/disco.com/test/Maildir/ //for maildir

3. Mailing list :
a. Create a/c like qmail-list@disco.com
b. Create .dot file like : .qmail-list in /var/qmail/alias
c. Put all the e-mail addresses in this file like :
&test123
&bubby@disco.com
&example@disco.com

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 auto@mydomain.com 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:

|/usr/bin/binfiles

5. Virtual domains :
The domain disco123.com has not hosted on titanic_mail.com 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 (mydomain.com) wishes to accept e-mail for virtual.com, then add the following line to your /var/qmail/control/rcpthosts file:
virtual.com

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

2 comments: