Qmail : How does it work ?
Qmail works using about 15 small programs. It also uses a pretty large number of configuration files. At the beginning, this may appear as quite confusing. Once you are familiarised with these configuration files & programs, qmail administration will be easier.
Qmail programs
Qmail continuously runs 5 daemons. Remaining 10 programs are launched by these 5 daemons as and when required.
Let us see which are the 5 daemons.
1. qmail-send
2. qmail-lspawn
3. qmail-rspawn
4. qmail-clean
5. tcpserver
How Qmail works
1. Email arrival in Qmail
Mail arrives in Qmail in two different ways.
(i) Locally injected emails.
There is a program called sendmail that comes with qmail. It is a program that mimics functionality of legacy sendmail, its arguments are also similar. sendmail accepts the local email and passes it to qmail-inject.
(ii) Remote emails arrived via SMTP
* tcpserver listens incoming connections on the SMTP port.
* upon a new SMTP connection, qmail-smtpd is launched.
* qmail-smtpd receives emails via SMTP.
2. Queuing emails
* qmail-inject & qmail-smpd pass received emails to qmail-queue.
* qmail-queue places emails in the folder /var/qmail/todo
* qmail-queue adds necessary headers to emails
* Then, it notifies qmail-send about newly queued emails.
3. Processing queued emails
* qmail-send takes the message out of /var/qmail/queue/todo folder
* qmail-send checks the recipient address of the email
* If the recipient addres is local, email is passed to qmail-lspwan
* If the recipient address is remote, email is passed to qmail-rspawn
4. Email delivery to local and remote recipients
* qmail-lspawn passes email to qmail-local
* qmail-local delivers email to local email address
* qmail-rspawn passes email to qmail-remote
* qmail-remote connects to remote mail server and delivers email to remote email address
5. Cleaning queue after delivering emails
* Once all messages are delivered, qmail-send notifies qmail-clean
* qmail-clean removes the delivered emails from the queue
Qmail configuration files
Qmail configuration files are located in the folder /var/qmail/control.
1. badmailfrom
All "from addresses" which are blacklisted.
2. bouncefrom
It is the bounce email from address. Usually it is "mailer-daemon".
3. bouncehost
It is host name of server
4. concurrencyincoming
Maximum number of simultaneous incoming SMTP connections allowed.
5. concurrencylocal
Maximum number of simultaneous local deliveries
6. concurrencyremote
Maximum number of simultaneous remote deliveries
7. defaultdomain
Default domain name of server
8. defaulthost
Host name of server
9. databytes
Maximum number of bytes in message (0=no limit)
10. doublebouncehost
It is the bounce email from address. Usually it is "mailer-daemon".
11. doublebounceto
It is the bounce email to address. Usually it is "postmaster".
12. helohost
It is the host name used in SMTP HELO command
13. idhost
It is host name of server. It is used when creating Message-ID.
13. localiphost
It is local IP address
14. locals
List of all local domains.
15. me
It is the hostname of server
16. morercpthosts
Only 50 domains can be added in rcpthosts, remaining domains should be in morercpthosts.
17. queuelifetime
It is the number of seconds an email can remain in queue
18. rcpthosts
Domains of all locally hosted email addresses.
19 smtpgreeting
It is the SMTP greeting message used by mail server.
20. timeoutconnect
Time in seconds, the server has to wait for SMTP connection
21. timeoutremote
Time in seconds, server has to wait for remote server
22. timeoutsmtpd
Time in seconds, server has to wait for SMTP client
23. virtualdomains
List of all virtual domains
No comments:
Post a Comment