Advertisment

Yahoo, Rediff use Qmail. So Can You

author-image
PCQ Bureau
New Update

Qmail as such is an SMTP (Simple Mail Transfer Protocol) server like sendmail and postfix. However, there are several packages floating on the Internet which when coupled with Qmail provide a full-fledged e-mail system with POP3, IMAP4 and a Web browser-based interface for e-mail. The Qmail Toaster is a project under which such packages are assembled at one place for download. Qmail Toaster provides source RPMs (SRPM) for these packages, which can be easily built into RPMs (and easily installed ) for popular distributions like Mandrake, RedHat and SuSE. What’s more, after installing Qmail Toaster, you get an out of box secure e-mail system with SMTP authentication and secure POP3 and IMAP mail access (over

SSL). 

Advertisment

We now proceed to set up the e-mail system on a machine running PCQLinux 8.0 distribution given out with the March 2003 issue of

PCQuest.

Preliminaries



Install PCQLinux 8.0 on a networked machine, designated to be your mail server. We assume the following parameters.







E-mail Domain: pcqlabs.net



IP Address of PCQLinux machine: 192.168.1.1 


Hostname of PCQLinux machine: mail.pcqlabs.net


Network: 192.168.1.0



A comprehensive web based interface for your POP3 or IMAP mailboxes using which you can manage your mail, set up mail folders, send mail with attachments and search e-mail
Advertisment

Make sure to substitute our parameters with yours, throughout the article. Before proceeding with building and installing the Qmail Toaster packages we need to set up a couple of things mentioned below.

Set up hostname



Make sure that you have set up a proper ‘hostname’ (mail.pcqlabs.net in our case) for the PCQLinux machine, during or after the installation. After installation, issue the following command.

hostname



If you see an output as localhost.localdomain, open the file named network found in /etc/sysconfig. Modify the line, which says:

Advertisment

HOSTNAME = localhost.localdomain 

to

HOSTNAME =mail.pcqlabs.net






Next open the file named hosts found in/etc directory and add your hostname against 127.0.0.1 separated by a space. Restart the network as:

Advertisment

service network restart

or, reboot the machine.

Set up DNS



For Qmail to run properly, you must have a working DNS (Domain Name Server) on your network. If you don’t have one, you can set up DNS on the same PCQLinux machine (the mail server). Refer to the article DNS on PCQLinux on page 93 in the March 2003 issue of PCQuest. You can also find this article in the archives on this month’s PCQuest Essential CD or online at: www.pcquest.com/content/linux/linux8/ 103030709.a sp. Set up the DNS using Webmin as explained in the article and remember to substitute pcqlabs.net with your e-mail domain. Instead of adding the entries for the Internet server and proxy server, add an entry for the mail server (name:mail.pcqlabs.net, address: 192.168.1.1). Next, you must add a mail server entry (MX entry) to your DNS. For this, click on pcqlabs.net icon and then on ‘Mail Server’. Specify the following.







Name: pcqlabs.net.



Mail Server: linux.pcqlabs.net.


Priority: 1








Note the trailing dots (.) in the first two entries.





Remove Sendmail and Postfix 





You must remove sendmail and postfix (if installed) using the following commands.







rpm —e sendmail –nodeps



rpm —e postfix –nodeps



Advertisment

Install the required RPMs



 
Make sure that the following RPMs are installed: perl-DBI,

perl-DBD-MySQL, mysql, mysql-server, mysql-devel, expect, httpd, httpd-devel, php, php-imap, php-mysql and php-devel. All these RPMs can be found on either of the two CDs of PCQLinux 8.0 in the directory PCQuest/RPMS. Install the RPMs using the following command.

rpm —ivh



Note: To install perl-DBD-MySQL use the –nodeps option, as:


rpm —ivh perl-DBD-MySQL-2.1017-3.i386.rpm —nodeps







Here httpd (Apache) and PHP packages are required for the Web-based interface. MySQL database is required by one of the packages called vpopmail of Qmail Toaster. Vpopmail provides virtual domain support for Qmail. It stores the domain information in a MySQL database. 

Set up MySQL



Start the MySQL database server as:







/etc/rc.d/init.d/mysqld start

Advertisment

Next, set up the root password for MySQL as:

mysqladmin —u root password pcq

Substitute pcq with your preferred password. Create a database named vpopmail as:

Advertisment

mysqladmin -u root —p create vpopmail

When prompted, enter the password that you had specified in the previous step. Next we need to sign access privileges to the vpopmail database. Issue the following:

mysql -u root —p

Enter the password as before. Next issue the following:

grant all on vpopmail.* to vpopmail@localhost identified by ‘secret’






Substitute secret with your preferred password. 

Install Qmail Toaster 



You can find the Qmail Toaster SRPMs on this month’s PCQuest Essential CD, in the directory

system/cdrom/umlimited_OSS/linux/qmail. Mount the CD and change to this directory. 






Compile or rebuild each of these SRPMS using the following command.






rpmbuild –rebuild -with rht8



The above command will produce RPMS in the subdirectories i386 or noarch of /usr/ src/redhat/RPMS/ directory. Rebuild the SRPMS in the following order: daemontools, ucspi-tcp-toaster, qmail-toaster, vpopmail-toaster, courier-imap-toaster, autorespond-toaster,maildrop-toaster, control-panel-toaster, ezmlm-toaster, qmailadmin-toaster, mrtg-toaster, qmail-mrtg-toaster,vqadmin-toaster, horde- toaster.

After rebuilding each SRPM using the above command, install the RPMS produced in the aforementioned subdirectories. The only expectation is, you must install qmail-pop3d-toaster, which is produced by rebuilding qmail-toaster SRPM, after installing the RPMS produced by vpopmail-toaster SRPMS. If all this sounds confusing refer to a step-by-step tutorial on rebuilding and installing the Qmail Toaster

packages at: www.ndhsoft.com/qmailtoaster.htm.

Next, open the file named ‘sql’ found in the directory /var/qmail/control. Substitute the value of pass with the password that you had specified with the MySQL grant statement in the section ‘Setup

MySQL’ (‘secret’ in our case). Next open the file named tcp.smtp found in

/etc/tcprules.d/tcp.smtp and modify the existing line to:

192.168.1.:allow,RELAYCLIENT=””

Open the file named php.ini found in the directory /etc and modify the lines register_globals = Off and short_open_tag = Off to:

register_globals = On



short_open_tag = On









Start and set up the system



Issue the following command.







service qmail start



service qmail cdb


service httpd start








To set up the e-mail system, access the Web interface using the URL http://192.168.1.1/admin-toaster/. When prompted, login using admin as the username and toaster as the password. Click on button labeled vqadmin-2.3.4 and then click on Add Domain. For the Domain Name, enter pcqlabs.net and enter a preferred password to administer the domain (postmaster password). According to your setup, enter values for the text fields under the Options section. Note that the values must be positive and non-zero, otherwise you will end up getting a script error later. Next, click on Add Email Account and fill in the following values, as an example:






Email address: shekhar@pcqlabs.net



Password: secret123


Quota: 1048576 (1 MB)


Full Name: Shekhar Govindarajan






Click on Add Email Account. Similarly add e-mail accounts for all the users on your network. 

Up and Running



The e-mail system should be now ready to use. Go ahead and set up the e-mail clients, such as Outlook Express, on your network. For outgoing (SMTP) and incoming (POP/IMAP) specify the IP address of the mail server ie 192.168.1.1. Note that your login or account name will be your full e-mail address, ie shekharg@pcqlabs.net and not

shekharg. 

To enable authentication (SMTP Authentication) in Outlook Express, in the account properties, click on Servers tab and tick the option ‘My Server Requires Authentication’. Click on Settings and select the option ‘Use same settings as my incoming mail server’. Besides SMTP authentication, the Qmail Toaster setup supports secure POP3 and IMAP connections (over SSL). To enable this, set the port number to 995 and 993, for POP3 and IMAP respectively. In  Outlook Express, in the account properties, click on the Advanced tab and simply tick the option ‘This server requires a secure connection’ under Incoming mail. 

To access the Web-based interface, browse the URL: http://192.168.1.1/horde -toaster/. Login using your full e-mail address and the password and enjoy browsing your e-mail through the comprehensive and feature-rich interface. 

For further information, refer to www.qmailtoaster.com, www.lifewithwmail.org and

qmail.org.

Shekhar Govindarajan

Advertisment