Qmail Howto

«»

Now, we can run make and install qmail.

echo "-lssl -lcrypto" > ssl.lib
make
make setup check

Note: If you get an error while running “make” that says: “Oops. Your system’s FD_SET() has a hidden limit of 1024 descriptors. This means that the qmail daemons could crash if you set the run-time concurrency higher than 509. So I’m going to insist that the concurrency limit in conf-spawn be at most 509. Right now it’s 1000.” – edit the file conf-spawn in your qmail directory and change the concurrency limit from 1000 to 509. Save and run make again.

If for some reason you are trying to compile qmail-1.03 instead of netqmail-1.05, you might encounter compilation problems with the latest versions of glibc (especially on Redhat Linux 9). In this case, use this patch and try recompiling qmail again. To apply the patch, cd to your qmail directory and type patch -p1 < qmail-1.03.errno.patch

Qmail and all of its subdirectories are installed in /var/qmail. Now we move to the configuration step.

8) Qmail post-install configuration

Before moving any further, it is best to create a link to qmail sendmail wrapper. The reason why we want this, is because many programs use sendmail to send email messages. By default, sendmail is installed in /usr/sbin/sendmail or /usr/lib/sendmail. We are going to symlink the wrapper:

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

Now we need to create necessary control files in /var/qmail/control. The examples below assume that your domain is “yourserver.com”. Of course, you have replace the occurrence of yourserver.com with your qualified MX host.

cd /var/qmail/control
echo yourserver.com > defaultdomain
echo localhost > locals
echo yourserver.com > me
echo yourserver.com > plusdomain
echo localhost > rcpthosts
echo yourserver.com >> rcpthosts
echo checkvpw > checkpassword
echo 1 > mfcheck
echo 20 > tarpitcount
echo 5 > tarpitdelay

The next step is to create various messages such as bounce and double bounce messages.

echo @nowhere.edu > badmailfrom
echo @nowhere.edu > badrcptto
echo mailer-daemon > bouncefrom
echo yourserver.com > bouncehost
echo 50000 > bouncemaxbytes
echo text > bouncemessage
echo failure notice > bouncesubject
cp bouncehost doublebouncehost
cp bouncemessage doublebouncemessage
cp bouncesubject doublebouncesubject

I will explain below in section 18.1 what “badmailfrom” and “badrcptto” are for and how to use them to fight against nasty spammers.

Now we need to edit two files – bouncemessage and doublebouncemessage. Therefore, launch your favorite editor and replace “text” with your bounce message. These files will contain the text that’s going to be displayed when a message bounces or double bounces. The example below uses vi to edit the files.

vi bouncemessage
vi doublebouncemessage

OK, the control files are all completed. Qmail configuration is now complete. The last thing that we need to do is set up a qmail startup script.

vi /var/qmail/rc

Copy-paste the following into the file:

#!/bin/sh
PATH="/var/qmail/bin:/usr/local/bin"
export PATH
cd /
qmail-start ./Maildir | setuidgid qmaill
multilog t n50 s1000000
/var/qmail/logs/qmail &

The first two lines of the script specify the path to executable files (so that we don’t have to write the complete path to qmail-start, setuidgid and multilog). The third line starts qmail, specifying Mailbox as the default directory for a mail user and sets “qmaill” as the user account under which multilog will be executed. The next line executes multilog, which is the logger we will be using for qmail. Here, we specify the number of maximum log files allowed in log directory (50) and the maximum size of a log file (1 MB). When a log file reaches 1 MB in size, the log will automatically rotate by renaming “current” log and creating a new empty log. When the number of log files reaches 50, it will automatically remove the oldest log prior to creating a new one. The last line represents the log directory.

Of course, we should not forget about making the startup script executable and creating qmail log directories:

chmod 755 /var/qmail/rc
mkdir /var/qmail/logs
mkdir /var/qmail/logs/qmail
chown -R qmaill:qmail /var/qmail/logs

9.1) Installing Ucspi-UNIX

cd /usr/local/src
tar zxf ucspi-unix-0.36.tar.gz
cd ucspi-unix-0.36
make
./installer

Note: If ucspi-unix fails during compilation with an error in env.c (sysdeps.h not found) you need to get bglibs and install it. After untarring the source, cd into the directory and run “make” followed by “make install”. Try recompiling ucspi-unix again. If compilation of ucspi-unix finishes without an error, type “./installer” to install binaries and manuals into /usr/local/bin and /usr/local/man, respectively. In some cases the installer gives an error “installer error: Could not change directory to ‘/usr/local/man’”. If you got this error just type “mkdir /usr/local/man” and then “./installer” again.

9.2) Installing Ucspi-TCP

The process is similar to qmail installation:

cd /usr/local/src
tar zxf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
wget http://www.qmail.org/ucspi-rss.diff
patch -p1 < ucspi-rss.diff
make
make setup check

Note: If ucspi-tcp fails during compilation with an error “collect2: ld returned 1 exit status”, you need to get two patches (patch 1, patch 2) and apply them to ucspi-tcp. Put these patches into /usr/local/src/ucspi-tcp-0.88 directory and type “patch -p1 < ucspi-tcp-0.88.errno.patch" and “patch -p1 < ucspi-tcp-0.88.nobase.patch". As usual, you’ll have to rerun “make” and “make setup check” to compile and install ucspi-tcp.

Now let’s configure tcpserver. Create a script called tcprulesedit in /usr/local/bin and copy-paste the following:

#!/bin/sh
vi /etc/tcp.smtp
/usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp

This script will take care of creating and editing relay rules in qmail. You can substitute “vi” with your favorite editor, if you want to.

As usual, make the script executable:

chmod 755 /usr/local/bin/tcprulesedit
tcprulesedit

The second line above runs the tcprulesedit script we’ve just created. Copy-paste the following lines into the editor:

127.:allow,RELAYCLIENT="",RBLSMTPD="",QMAILQUEUE="/var/qmail/bin/qmail-queue"
:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"

Note: If you are not planning to install qmail-scanner, you should remove the QMAILQUEUE definitions above. Of course, don’t forget to get rid of all “,” (commas) at the end of the lines as well.

For security purposes, we are only allowing localhost (127.) to relay messages. Since messages coming from localhost will most probably not contain spam or viruses, we are specifying qmail-queue as the default executable for incoming mail. This will also decrease the server load when processing mail between local mail users. The second line of the script just tells tcpserver to process all other mail using qmail-scanner (to fight against spammers and viruses), the installation of which I will be covering later in this guide.

10) Moving on with Daemontools

Daemontools installation differs from other installations, because you don’t have to “configure” or “make” the package. A directory is created in your root structure, and all working files are placed there. Follow the instructions below to properly install Daemontools on your system.

mkdir -p /package
chmod 1755 /package
cd /package
mv /usr/local/src/daemontools-0.76.tar.gz /package
tar zxf daemontools-0.76.tar.gz
mv daemontools-0.76.tar.gz /usr/local/src
cd admin/daemontools-0.76
package/install

Note: If daemontools fails during compilation with an error “collect2: ld returned 1 exit status”, you need to get a patch and apply it on daemontools. Put the patch into /package/admin/daemontools-0.76 and type “patch -p1 < daemontools-0.76.errno.patch". After the patch is applied successfully, cd into /package/admin/daemontools-0.76 and type “package/install”. Daemontools should now be installed and fully operational.

That’s it, Daemontools package is installed.


No related posts.

About Nasim Mansurov

is a professional photographer based out of Denver, Colorado. He is the author and founder of The Mansurovs, along with a number of other online resources. Read more about Nasim here.

Comments

  1. 1
    ) Craig White

    Wow, this Qmail guide is simply awesome! It helped me a lot, thanks!

  2. I am so thankfull to you because your this qmail Installation guides solves my all qmail related problems and now i make a mail server very confident
    Thanks again for helping to other peoples

  3. 3
    ) Roland T. Lichti

    Hey, your howto is great. simple, straight forward. I was able to pick the things I want and dumpt the others. Keep up the great work :-).

  4. Really helpful. Thank you Nasim!
    I have a Mandrake 10 setup, and the only problems I have had so far with this guide are:
    - with higher Mandrake security levels (msec 4) I have to cd to /var/qmail/logs in the qmail rc file because root (/) is not readable by user qmaill and the security system diligently reverses a ‘chmod o+r /’
    - qmail rc file should say ‘qmail-start ./Maildir/’ NOT ‘qmail-start ./Maildir’

  5. 5
    ) Tbone

    First of all I think you have done a great job in writing these tutorials or guides. However this qmail guide is rather confusing….at least to me. You don’t mention anything about qmail-1.03 during the downloading of the source files…but all of a sudden, you want the user (person who is installing or following this guide) to cd to /usr/local/src/qmail-1.03.

    In other words, you finish patching and then you create the /var/qmail directory and then …..out of no where you do # cd /usr/local/src/qmail-1.03 and continure with adding the needed users and groups for qmail. Then the most confusing thing about your guide is when you make small Note: which ends like this ………..If for some reason you are trying to compile qmail-1.03 instead of netqmail-1.05, you might encounter compilation problems with the latest versions of glibc (especially on Redhat Linux 9). In this case, use this patch and try recompiling qmail again. To apply the patch, cd to your qmail directory and type patch -p1 < qmail-1.03.errno.patch ………. My question is "should there be any reason why someone should be installing qmail-1.03 ? If yes …how come you have not mentioned it ? At least in the phase where you download all the source files. May be I am dumb ….but this is a little frustrating. Anyway, I hope you don't take this as an attack …..I have no such intentions…

  6. 6
    ) Tbone

    I figured it out. I guess I am dumb ….but this is what you have to do u happen to get an error or come to a place where u r as confused as I was …do the following;

    where is says “cd /usr/local/src/qmail-1.03″ do “cd netqmail-1.05″ and then continue with “make” and then “make setup check” . Thanks for the wonderful guide. I used the apache install guide too and that had a key peice of information missing. But all in all …great job …keep up the good work.

  7. 7
    ) MegaZ

    Tbone: Regarding your first comment – I’ve had a typo, thanks for letting me know.

  8. 8
    ) tarbash a.k.a Tbone

    First of all, please don’t take my comments as personal attacks ….lol ….not the intention. The reason why I am mentioning this is because, when I read my own comments they come out as very negative. I guess I was frustrated …I apologize for that,. Anyway, on page five of the qmail guide …if you focus on the area where you are installing the sophos anti virus, first of all you might want to consider upgrading the guide to say something I found out. When installing Sophos to work with Sophie, you are going to find out that sophos is not free. Cannot be bought online unless you contact one of the local sales person. You might be able to find the file “linux.intel.libc6.tar.Z” and there is another one which was compiled with/on an earlier version of glibc and/or gcc. I am not sure. If you google this, you might come across a post where the solution appears to be compile Sophos on a earlier version of RedHat 7 or 8. I might give it a try after I get my RH 7.3 going. Even though I was able to install Sophos and even got the ‘sweep -v’ to work. Was able to scan to on my RH 9. But when installing Sophie, you are going to get nagging error when Sohpie tries to find the savi libraries even though we specify it on the ./configure command. For example, # ./configure –with-user=qmaill –with-group=nofiles –with-savilib=/usr/local/lib . Even though the libraries were there in my case, the configure script was not seeing it. I am also suspecting a ldconfig issue. So in short ……………. I think I am going to by the savi engine ( heard you can buy that separately) and then going to start from scratch on my RH 7. Another place there could be some confusions/problems is the place where you are installing the PERL module Sys::Syslog. I ran into alot of issue here. If you have any questions please let me know. Great guide…..Gotta say …..A great guide that I have seen in a very long time.

  9. 9
    ) Ozymandias

    I found that the Maildrop wouldn’t compile, had to download it from this location instead

    http://www.courier-mta.org/?download.php~maildrop

  10. 10
    ) juarez

    checking for SAVIsweepFile in -lsavi… no
    ** libsavi library NOT FOUND
    ** You need libsavi in order to use Sophie.
    ** Download it at http://www.sophos.com/

    This error persist.
    I create libsavi.so for libsavi.so.3

    Please.. help me!

  11. 11
    ) hitomi

    I cann’t compile “qmail-autoresponder” at Fedora Core 3
    Setup and Testing has Completed…

    Error Message ….
    [shinseunghyeok@gumi_in_korea qmail-autoresponder-0.96.1]# make
    ./compile qmail-autoresponder.c
    qmail-autoresponder.c:6:21: str/str.h: No such file or directory
    qmail-autoresponder.c:7:21: sysdeps.h: No such file or directory
    In file included from qmail-autoresponder.c:8:
    qmail-autoresponder.h:18: error: syntax error before “response”
    qmail-autoresponder.h:18: warning: type defaults to `int’ in declaration of `response’
    qmail-autoresponder.h:18: warning: data definition has no type or storage class
    qmail-autoresponder.c: In function `read_message’:
    qmail-autoresponder.c:25: warning: implicit declaration of function `str_catb’
    qmail-autoresponder.c: In function `count_history’:
    qmail-autoresponder.c:63: error: `DIR’ undeclared (first use in this function)
    qmail-autoresponder.c:63: error: (Each undeclared identifier is reported only once
    qmail-autoresponder.c:63: error: for each function it appears in.)
    qmail-autoresponder.c:63: error: `dir’ undeclared (first use in this function)
    qmail-autoresponder.c:63: warning: implicit declaration of function `opendir’
    qmail-autoresponder.c:64: error: `direntry’ undeclared (first use in this function)
    qmail-autoresponder.c:64: error: `entry’ undeclared (first use in this function)
    qmail-autoresponder.c:85: warning: implicit declaration of function `readdir’
    make: *** [qmail-autoresponder.o] Error 1

  12. 12
    ) Chris Malateta

    You forgot to have people create teh qmail user…. you first realize this when you go to set the ownership of /var/qmail/logs… OOOOOPPPPSS!

  13. 13
    ) hitomi

    I have already user qmail… and changed ownership ‘qmaill:nofiles’ at /var/qmail/logs…. Hmmm….

  14. 14
    ) Angus Lee

    First of all, this installation guide gives me very direct instruction on how to install qmail and related stuffs. I used this guide to install for more than 3 email servers. However, since net-qmail-1.05, i found a very strange problem when applying all the patch, as suggested in this guide. Sometimes, the qmail-smtpd process will be in dead-looping, and occupy server loading 1 for each looping process. ( i.e. 3 dead looping qmail-smptd process, the server loading become 3, and those process will never die itself ).
    After few weeks of observation, i found that some SMTP connection to this full-patched email server will cause the qmail-smtpd to hang. As i can’t repeat the dead-looping by myself, i can just have no solution to it. Yesterday, i found that, when using Norton 200x, with outgoing email scanning, and use this server as SMTP server, the smtpd process will certainly in dead-looping. and in client side, the notron scanning for that particular email will hang, and finally time out.
    I’m not sure which patches here, related to smtpd.c will cause this… anyway, don’t apply any patches solved the problem i encountered.
    I just want to report. and let see any guys have the same problem.. and anyone have idea which patch would cause this problem.. Thx.

  15. 15
    ) MegaZ

    Don’t apply “qmail-antispoofing.patch” – it’s the one that’s causing the hang issue.

  16. 16
    ) Norium

    Hello,

    I’m installing qmail and I have the same problem than hitomi with the qmail-autoresponder compilation under Fedora. I have the same error message (patched or not) and trying the both make commands). Anyone solved that ?

    Thank you

  17. 17
    ) tarbash

    Another small addition. Before starting the Courier-imap install, think whether you will ever need to run secure imap process…if the answer is YES …then you might want to enable the ssl support. (e.g. –with-ssl ). There are other nice configuration options that you might want to think about if you are planning on using Courierpassd utility to allow users to change their passwords remotely. Especially when using together with Squirrelmail to change users passwords. There is a good document I came across that explains how to set all this up. If you have a little brain cells available and some time …you can combine the section on installing courier-imap from this tutorial with the one I found which should be available at http://freebsd.qmailrocks.org/imap.htm This site has some good resources. Another document that might come in handy if you want to know about courier-imap options and stuff …check this out http://www.inter7.com/courierimap/INSTALL.html#requirements

    Later all. ……keep up the good work ….

    ——–tarbash

  18. 18
    ) vasix

    U R THE MAN!
    many thanks for your work!

  19. 19
    ) airman

    I was wondering if anyone has seen a problem with qmail where after DATA is requested it sends the 354 go ahead … but it times out at this point .

    I am unsure if qmail/tcpserver is not accepting a line of data then just times out or if the other side is not sending the data at this point..
    It seems to be a problems when the other server is postfix and the message is larger. In anycase I am losing emails because the server is timing out at that point and sending
    451 timeout(4.4.1) … if I send a small message from the same server it goes though find though
    any ideas?

  20. 20
    ) tarbash

    airman , what are your memory limits set to ?

  21. 21
    ) Loki

    Please add downloadable scripts in text format, this will make life a lot easier for those of us using lynx.

    Thanks for the great guide …

  22. 22
    ) Anonymous

    About the vdeliver-postdeliver script, the right line should be :

    qmail-autoresponder $MAILDIR/autoresponse/message.txt $MAILDIR/autoresponse

    Well at least for the example given in the tutorial didn’t work. To be really clean you can add a `pwd` before the $MAILDIR

  23. 23
    ) Angus Lee

    I’m using courier-imap-3.0.7 with fedora core 2 (2.6.5-1.358smp).

    For two servers with this config, i found that when user check email through webmail (squirrel mail), the email should move from “new” user folder to “cur” user folder (from courier-imap’s basic config). However, some “dead” file will be generated inside the “cur” folder. When i “ls” that file, “Input/Output Error” will be generated in console.

    This error happen quite often. I cannot delete those file coz this will crush the parition (i tried) and end up to format that partition again. I’m quite sure that it is the problem related to this courier-imap release and this linux kernel, by prove by two different hardware config servers. I searched through web and have no solution.

    Can anyone help me on this? or anyone encountered the same issue?

  24. 24
    ) dan

    Anyone knows how a user from local domain can be controlled to send or not mail to a qmail-ldap alias(using a /var/qmail/alias/.qmail-x file) ?
    (Maybe u can send an answer to dann26@gmail.com to). Thank you.

  25. 25
    ) Andre Kasto

    Hi, How do I collect all messages sent to non existent users on my qmail server to a single account (spamtrap)? Ex: messages to 090191@example go to spamtrap@example

  26. 26
    ) Shane

    I’m using the latest courier-imap (version 4+) and the installation is broken down into two packages (courier-imap / courier-authlib) and i was wondering if anyone can get imap to work because this writeup uses 3.0 courier-imap and at that time they were the same package i think. Every time i click on the folders to dl them i instantly get an error.
    All the directories are different but i linked most of them and pop3/smtp works great just can’t manage to get imap working.

    I’m also having the same issue with qmail-autoresponder on the compile that someone posted in post # 11. Any fix yet?

    Jun 15 19:41:31 pnot imapd: Connection, ip=[::ffff:63.115.64.11]
    Jun 15 19:41:31 pnot imapd: authdaemon: s_connect() failed: Connection refused
    Jun 15 19:41:31 pnot imapd: [Hint: perhaps authdaemond is not running?]
    Jun 15 19:41:31 pnot imapd: LOGIN FAILED, user=test@pnot.camnv.com, ip=[::ffff:63.115.64.11]
    Jun 15 19:41:31 pnot imapd: authentication error: Connection refused

  27. 27
    ) Graham Miller

    The error in post#11 is due to not finding the bglibs package. It needs to be installed and then the conf-bglibs and conf-bgincs file need to be upgraded to point to where ever they are installed.

  28. 28
    ) enora

    Hi,

    i have done all the steps, but i don’t understand where the passwd file is? how can i recognize th user? can you tell me.

    thanks in advance,
    Enora

  29. 29
    ) nurbo

    I try to use linux base

  30. 30
    ) erno666

    Hi,

    It’s a great site, congratulations!
    I’ve found a qmail-antispoofing.patch in your qmail_patches.tar.gz, but I haven’t seen description of it. Could you write a couple of sentences about it?

    Thank, Erno

  31. 31
    ) Will

    If anyone has been having problems check your runmail logs: /var/qmail/logs/pop3, vmailmgr, and smtp. I was having a problem where the logs reported funny errors:

    relay-ctrl-chdir[4385]: Fatal: execution of program failed!

    i discovered i was receiving that error because i already was running another pop and smtp service from a plesk installation i thought i disabled. i ran the tcpserver command inidividually and got the error referenced here about binding to port 100 http://www.qmailrocks.org/faq/?category=qmail#48 . I double checked and sure enough the services were starting.

    Guide guide Nasim my hats off to you. I’m completely new to email and if it werent for this excellent guide i never would have gotten through it.

    Thanks,

    will

  32. 32
    ) sam

    How to apply SMTP-AUTH patch without errors.

    thnks for the nice guide

  33. On Debian Sarge, before running the configure script for courier-imap-3, I had to install libgdbm-dev package first:
    # apt-get install libgdbm-dev

  34. On Debian Sarge, before running make for courier-imap-3, I had to install libgssl-dev package first:
    # apt-get install libssl-dev

  35. On Debian Sarge, I could compile vmailmgr-0.97 with the default compiler (gcc-3.3.5) without any problem :)

  36. 36
    ) alexpixel

    good tutorial, i plan to implement on solaris, hope it works!
    would be better if instead of sophos utilize clamav ? to keep all free or open?

  37. 37
    ) Karl

    qmail-scanner 2.01 have better function to deal with spam mail, but I can’t make it work (can’t get mails anymore! ), would you please have a try and share at here?

  38. 38
    ) Ameer

    Hello.

    Thanks in a bunch for a nice guide.
    I believe this guide will fix my existing problem – because now, my MTA accepting all incoming emails eventhough there are no such addresses.

    Keep on the good work!

  39. 39
    ) Dragos

    [root@tech-hosting/programe/QMAIL/relay-ctrl-3.1.1]# /var/qmail/rc
    /var/qmail/rc: line 5: setuidgid: command not found
    [root@tech-hosting/programe/QMAIL/relay-ctrl-3.1.1]# /usr/local/bin/runmail
    /usr/local/bin/runmail: line 8: setuidgid: command not found
    /usr/local/bin/runmail: line 17: setuidgid: command not found
    /usr/local/bin/runmail: line 25: setuidgid: command not found

  40. 40
    ) Spud

    if you don’t create control/smtpgreeting

    you cant start smtpd…

    qmail-smtpd.c:119
    if (control_rldef(&greeting,”control/smtpgreeting”,1,(char *) 0) != 1)
    die_control();

    [root@mailings ~]# telnet localhost 25
    Trying 127.0.0.1…
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is ‘^]’.
    421 unable to read controls (#4.3.0)
    Connection closed by foreign host.

    so, create controls/smtpgreeting

  41. 41
    ) Anonymous

    You have provided a solution with easy steps..nice to know it!

    Don Lapre Albert
    webmaster@gidnoc.com
    http://www.gidnoc.com

  42. 42
    ) Sumit

    Dear Mr. Nasim,

    Your configuartion script is really good one but little tough..anyway its good.

    Do you have any configuration manual to install netqmail in debian-3.0 ?

    Do you have any configuration manual to install PPP in debian-3.0?

  43. 43
    ) Anonymous

    Rajesh says,

    I want to know whether the qmail users are systems users like in qmail or database users like in qmail-toaster.Please let me know

    My email id rajesh.webindia@gmail.com

  44. 44
    ) Rik

    During Courier-IMAP Installation (page 5), it won’t compile on Fedora core 4, or 6.
    I tried it on FC6 first. Then I tried it on a clean install of FC4.
    Both times, the “make” step give this error:

    make[2]: Entering directory `/usr/local/src/courier-imap-3.0.8/authlib’
    Compiling authexit.c
    Compiling chain.c
    chain.c: In function âauthchainâ:
    chain.c:49: warning: ignoring return value of âdupâ, declared with attribute warn_unused_result
    Compiling checkpassword.c
    Compiling cryptpassword.c
    Compiling authstaticlistsearch.c
    In file included from authstaticlistsearch.c:9:
    /usr/include/stdio.h:385: error: syntax error before â&&â token
    make[2]: *** [authstaticlistsearch.o] Error 1
    make[2]: Leaving directory `/usr/local/src/courier-imap-3.0.8/authlib’
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/usr/local/src/courier-imap-3.0.8/authlib’
    make: *** [all-recursive] Error 1

    A search on google / yahoo turned up somebody else who encountered the same error on FC5. But no solution on how to fix the problem.

    Note:
    I ran configure as follows:
    ./configure –disable-root-check –with-redhat

    and it ran without a problem.

    I’m currently stuck.

    Any ideas on how to solve this?

  45. Nice post,thanks a lot! :)

  46. 46
    ) Rogerio Martinelli

    I have to send more than 1 million mail per day . how can increase qmail with these patches.
    thanks a lot.
    RM

  47. 47
    ) Valilij
  48. 48
    ) praveen

    Hi,

    everything works fine, but the usernames containing . (dot) like praveen.b are not working on the server it says invalid username. anyone here can help me?

    thanks in advance,
    Praveen

  49. 49
    ) Rizwan Khalid

    sir i wan to take ur help regarding qmail.as i am the student of MIT (Master Of Information Technology) .sir i have to submit my final project which is “Implemantation of qmail Server” Sir can u help me or guid me how i can perform well.what will be the steps which i have to folow so that i can complete my project with in time.i have only one month to complete my task.
    waiting for ur rply .thank you

  50. 50
    ) claudio

    Thank You very much, it´s very good.
    I have a problem with qmail inject and something comes out on the screen like:
    “qmail-inject: fatal: qq waitpid surprise (#4.3.0)”
    do you have an idea to fix-it ?

    sorry for the inconvinience

  51. 51
    ) Miguel

    I have a problem with autoresponse. When it send’s the response, the sender address goes like this “”@domain.com . This way, it’s always flaged as relay, on my relay server.
    Do you have any hint?

  52. 52
    ) Saji Alexander

    Hi,

    Really good site. Thanks for your valuable help. Do you have anything similar for postfix,mysql,dovecoat with webmail option. Since all these can be installed along with the O.S. and only need to integrate.

    Rgds,

    Saji Alexander.

  53. 53
    ) Kaf

    if you’re having problems making Courier for Fedora/Redhat with error /usr/include/stdio.h:385: error: syntax error before ‘&&’ token , you can find information here http://atmail.com/view_article.php?num=199

    • 79
      ) Jorge Reteguin

      That article no longer exists.
      It has been replaced by: http://atmail.com/kb/?p=270

      Just in case it disappears again, here it is:
      ———————-
      Description: The standard Courier-IMAP 3.0.8 distribution will not build on stock Fedora/Redhat systems. Compilation fails while building the authlib library, usually with an error message like:

      In file included from authstaticlistsearch.c:9:
      /usr/include/stdio.h:385: error: syntax error before ‘&&’ token

      A review of the stdio.h file shows that no ‘&&’ symbols appears on or near line 385.

      Solution: The courier-imap/authlib directory contains a file named ‘debug.h’ to support the debugging of authentication attempts against the Courier IMAP server. This file contains a C preprocessor macro named ‘dprintf’ that conflicts with the ‘dprintf’ function defined in glibc’s ‘stdio.h’. This conflict isn’t a problem so long as ‘#include ‘ appears before ‘#include “debug.h”‘ in the authlib source files. Unfortunately, this is not the case for files ‘authstaticlistsearch.c’, ‘authmoduser3.c’, ‘mod.h’, ‘authtest.c’, ‘debug.c’, and ‘authdaemon.c’.

      To fix this problem, open these files in a text editor and move the ‘#include “debug.h”‘ line so that it is the last include directive. Make sure that you do not paste it into a ‘#if … #endif’ block. Once you have made these changes, the build process should succeed.

  54. 54
    ) Hane

    I installed Your Qmail-modification a couple of years ago. Thanks for that! Now I would like to use your patch for bounce handling.

    patch

  55. 55
    ) satish

    Hi,

    how can we know a email is bounced or not ?? qmail handles smtp return codes ??

    Thanks,
    Satish.K

  56. 56
    ) amir

    /usr/local/bin/setuidgid qmaill “contrib/test_installation.sh -doit”
    i stuck at that line and my fedora 8 give me :

    /usr/local/bin/setuidgid qmaill “contrib/test_installation.sh -doit”
    setuidgid: fatal: unable to run contrib/test_installation.sh -doit: file does not exist

    AND also when i run : # /usr/local/bin/setuidgid qmaill
    “/var/qmail/bin/qmail-scanner-queue.pl” -g
    perlscanner: generate new DB file
    perlscanner: total of 9 entries.

    my fedora 8 only reply : perlscanner: generate new DB file

    **Please help me, it’s already 2 to 3 days since i tried to solve it but can’t…

  57. 57
    ) Yuriy

    Hi Nasim. Thanks a lot for providing nice and very helpful instructions in plain english :-)
    I’ve installed mail production server on Debian(4) using your guidlines.
    Although I came across some problems after install, i.e. when I have created second virtual domain, mail server stopped recieving any messages at all(even though the first virtual domain was working on it’s own before). Is it something to do with Qmail-Scanner, where by one required to enter domains’ names before installing it(–local-domains “domain.one.com,domain.two.com”; page 5 of your instractions)?
    Thanks a lot in advance if you can spare some time to answer this question.
    Kind regards,
    yuriy

  58. 58
    ) MegaZ

    Yuriy, are you still receiving mail for the first domain that you had created before? Also, a little troubleshooting would definitely help. Try this:
    1) Telnet to your server’s IP address port 25 by typing “telnet x.x.x.x 25″
    2) Type “HELO test.com” or some other domain and press enter
    3) Type “MAIL FROM:test@test.com” and press enter
    4) Type “RCPT TO:test@yourdomain.com” and press enter
    5) Type “DATA” and press enter
    6) Type some garbage and then type “.” on a separate line. The server should respond “250 ok xxxxxxx qp xxxxx”.
    7) Type “quit” on a separate line and see what output you get.
    8) While doing all of the above check your qmail logs. Both the incoming tcp logs and your qmail logs.
    9) After you are done with the telnet session, your logs should report what the problem is.

    If your domain is not in one of the configuration files, you will get a descriptive error in the log. If there is any other problem, you should see it in the log as well.

    If you can’t telnet to your server, then your tcpserver is having a problem and might need to be rebooted.

    Hope the above helps.

    Nasim

  59. 59
    ) aulia

    i’m sorry..could you give me a module to make QMAIL in SLACKWARE 12, i have try to make it, but not suxess..please. for my homework

  60. 60
    ) Yuriy

    Hi Nazim.
    I can telnet to my server and do all steps you have listed alright. It’s just when I’m trying to set additional virtual domain it stops receiving emails(one can still send emails though) even to the first virtual domain. When I remove the second virtual domain it will start to receive emails but only after couple hours.I reckon that it’s Qmail-Scanner coursing this problem. I probably leave this issue to sort later on(I’m planning to install another test server but will keep in mind using more than one domain then).
    I have couple more issues which require immediate attention and I was trying to sort them out but no luck so far.
    1. I need to set our email server to give a 550 error for an invalid address. I have used Andrew Richards’ qmail-verify patch(http://free.acrconsulting.co.uk/email/qmail-verify.html). I can see qmail-verify daemon is running on our server but it’s not rejecting non-existing users(so it’s accepting anything with our domain). The problem could be that /home/email/[virtual_domain]/.qmail-default telling that anything coming with this domain is valid.
    But because I’m using virtual domain .qmail-default pipes to /usr/local/bin/vdeliver.So vdeliver is deciding who is right users on our server. Andrew suggested to remove /home/email/[virtual_domain]/.qmail-default but when I did it email server stopped to receive emials. Do you know what parameters I need to pass to /usr/local/bin/vdeliver in /home/email/[virtual_domain]/.qmail-default so qmail-verify can properly filter email users?
    2. Due to the increase in the number of ISP’s blocking port 25 for third party mailservers I need to set on mail server additional port to answer SMTP request. I was looking on google and found the following link http://www.skorpionweb.org/archives/2005/09/running_qmail_s.php.
    So I followed the logic in this article and set separate tcpserver which listens to different port:
    1) Created /var/qmail/rc2 :
    #!/bin/sh
    PATH=”/var/qmail/bin:/usr/local/bin”
    export PATH
    cd /
    qmail-start ./Maildir | setuidgid qmaill
    multilog t n50 s1000000
    /var/qmail/logs/qmail2 &

    2) Created /usr/local/bin/runmail2:
    exec softlimit -m 10000000
    envdir /etc/relay-ctrl relay-ctrl-chdir
    tcpserver -v -H -R -l $HOSTNAME -x /etc/tcp.smtp.cdb -c200 -u5002 -g5000 0 587 qmail-smtpd 2>&1 &

    3) Created /var/qmail/logs/qmail2 and chown it to qmaill:nofiles.

    Now I can start separate tcpserver with port 587 and everything looks healthy with but when I change port 25 to 587 and try to send mail I have got an error “…The server may be unavailable or refusing connection…”
    I wonder whether I need to set another instance of qmail-smtpd(may be qmail-smtpd2, just guessing here).

    Thanks a lot again for your time and effort to keep this site going & helping folks like myself :-)
    Kind regards, yuriy

  61. 61
    ) Yuriy

    Hi Nazim,

    Problem with setting second virtual domain was sorted out. It turned out that one needs to restart qmail server after adding another virtual domain.
    Also I have sorted an issue with 550 error page(I have wrote about it in one of my previous posts).
    With virtual domain .qmail-default file should exist for each user. So solution was pretty simple: copy original .qmail-default to .qmail-USERNAME in /home/email/yourdomain/ folder. Also my /etc/tcp.smtp looks like this:

    127.:allow,RELAYCLIENT=”",RBLSMTPD=”",QMAILQUEUE=”/var/qmail/bin/qmail-queue”
    :allow,QMAILQUEUE=”/var/qmail/bin/qmail-scanner-queue.pl”,VERIFY=”"

  62. 62
    ) Yuriy

    Hi Nazim,

    Sometimes I have an error when sending email(addresses which I used before or new):

    An error occurred while sending mail.The mail server responded: sorry, that domain isn’t in my list of allowed rcpthosts(#5.7.1). Please check the message recipients and try again.

    I thought that it something to do with timing out authentication so I have removed 900 from /etc/relay-ctrl/expiry(step 12->Installing Relay-CTRL; pagehttp://mansurovs.com/2002/12/20/qmail-howto/4) but I’m still getting this error.
    I’ll appreciate if you could advice on what could be wrong, please.

    Thanks a lot in advance,
    yuriy

  63. 63
    ) Jorge Reteguin

    Hi Nasim:

    Have you tried to use CourierIMAP 4.3.1 (with AuthLib)?
    I would appreciate your comments about it.

    Thanks.

  64. 64
    ) Bill

    This was helpful. Thank you.

  65. 65
    ) hugl3

    Nice tutorial. If anyone needs help, you can contact my via email on my website.
    I could do it for free.

  66. 66
    ) Carlos

    > – Qmail Patches from http://mansurovs.com

    Where is the patches, i find but…

  67. 67
    ) Martin F

    So what if I want a more minimalistic solution. Basically I have a mail server that only needs to serve one site, and primarily outgoing mail. So no fancy stuff needed like multiple users and auto-responders.

    I would like to have a suite of admin tools, for instance, being able to manually send an email that’s been stuck in the queue and watching the remote mail server response, ideally have a php script parse this information.

    Hours on Google have really only given me scripts for the end-user, none for really managing the admin part of qmail.

  68. 68
    ) Nelson

    Nice tutorial. This is only the patch that I haven’t encountered a problem.

    I hope you can add a patch such as validrcptto. This is nice patch. However, I’m getting a hunk failed when I’m trying to patch it after patching all the patch on your tutorial. Probably, some code doesn’t conform to validrcptto patch. I’m not a C programmer so I’m getting a hard time fixing the problem. Please inform me via my email ntserafica@yahoo.com if you have the patch.

    This could be a great gift this coming christmas :)

  69. can you have an instruction on how to get squirrelmail work together with your tutorial..
    Thank in advanced

  70. I followed you through step 17.1 everything work fine but when I telnet to port 15 and 110 …these errors occur
    ===============================================
    telnet 127.0.0.1 25
    Trying 127.0.0.1…
    Connected to localhost (127.0.0.1).
    Escape character is ‘^]’.
    220 tnway.com ESMTP
    exit
    502 unimplemented (#5.5.1)
    quit
    ======================================================
    telnet 127.0.0.1 110
    Trying 127.0.0.1…
    Connected to localhost (127.0.0.1).
    Escape character is ‘^]’.
    +OK
    hello
    -ERR authorization first
    exit
    -ERR authorization first
    =============================================

    What wrong with me ? I really need your help
    Thank in advanced

  71. 71
    ) MegaZ

    billyduc,

    Just install Courier IMAP and you will be able to use Squirrelmail or any other web-based mail system. I personally use Horde http://www.horde.org/ and love the functionality.

    Regarding your other issues with telnetting – the output seems to be normal and the services are responding. Did you try to send an email to your server through an external provider like gmail/yahoo? Did you try to use a client like Outlook to download emails through POP3/IMAP?

    Nasim

  72. I use Evolution for email client.
    I setup for “test” account to send and receive mail
    When I clicked Send / Receive Button. It prompt me

    Unable to connect to POP server myhost.mydomain.com.
    Error Sending password : -ERR authorization failed
    Please enter the POP password for test on host myhost.mydomain.com

    I enter the password for test account……But the error window is open
    Error While Fetching Mail
    Unable to connect to POP server myhost.mydomain.com.
    Error Sending password : Operation now in progress

  73. 73
    ) rkarim

    hey, i wrote a practical step-by-step how-to on qmail… please see the link: “http://www.linux-bd.com/” , i hope some one will require it.

  74. 74
    ) Roland

    Great howto, tnx!

  75. 75
    ) Jerry

    When I was trying to compile the qmail-autoresponder-0.97, it gave me the following error messages:

    main.c: In function âexec_qmail_injectâ:
    main.c:257: warning: missing sentinel in function call
    ./compile options.c
    options.c:1:25: error: mysql/mysql.h: No such file or directory
    make: *** [options.o] Error 1

    I have the mysql installed. Please help.

    Thank you

    • 76
      ) Andreas Brisner

      I did “apt-get install libmysqlclient15-dev” and it solved the problem with options.c:1:25: error: mysql/mysql.h: No such file or directory

      • 77
        ) MegaZ

        Andreas, thank you for the input!

        Whenever there is a problem with mysql.h not being found, you need to install the mysql client source files, just like you did.

  76. 78
    ) Ali Butt

    Hello,

    I like to forward all bounced emails for all of my user accounts to a single account.
    is there a qmail setting or patch that allows me to forwards all bounced emails of my user accounts to a single admin account?

    Regards

  77. 80
    ) randy

    Hi, qmail admins, i have a problem editing the vcheckquota.c file under vmailmgr-tools-0.2. when i add the Warning: the soft…blah blah” in one line to line 36, i get these errors:
    vcheckquota.c:36: error: expected identifier or ‘(’ before string constant
    vcheckquota.c:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘=’
    vcheckquota.c:40: error: stray ‘’ in program
    make: *** [vcheckquota.o] Error 1

    please help. thanks.

  78. 81
    ) Mstaaravin

    Where you configured maildrop options and filters…………?
    i prefer spamdyke + simscan but, always i failure with maildrop :(

    If you resolv maildroprc config for netqmail-1.06 + vpopmail-5.4.30 i send you a pack of six argentinian wine bottle.

    :D

  79. 84
    ) Thibs

    If you are interrested by a quiet similiar guide for Debian 5.0 (Lenny), take a look to http://qmailrocks.thibs.com/

  80. 85
    ) Jerry

    Great instructions. I’ve setup numerous qmail server with this. Now for the question, is there a way to set a quota for each user or domain?

    Thank you.

  81. 86
    ) Nelson

    Thanks for the patches. I’m having difficulties integrating patches that comes from different authors. I want to know if you have patch for SPF? I tried to install some patch from different author but it has FAILED error and I don’t know how to debug it. When I used your patch, everything went perfect so I ‘m hoping you could provide or add a patch for enabling spf.

    Thanks,

    Nelson

Speak Your Mind

*