{"id":914,"date":"2012-08-02T16:12:06","date_gmt":"2012-08-02T08:12:06","guid":{"rendered":"http:\/\/rmohan.com\/?p=914"},"modified":"2012-08-02T16:14:02","modified_gmt":"2012-08-02T08:14:02","slug":"qmail-how-does-it-work","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=914","title":{"rendered":"Qmail : How does it work ?"},"content":{"rendered":"<h3>Qmail : How does it work ?<\/h3>\n<div><\/div>\n<p>Qmail programs &amp; configuration files<br \/>\nQmail 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 &amp; programs, qmail administration will be easier.<\/p>\n<p>Qmail programs<\/p>\n<p>Qmail continuously runs 5 daemons. Remaining 10 programs are launched by these 5 daemons as and when required.<\/p>\n<p>Let us see which are the 5 daemons.<\/p>\n<p>1. qmail-send<br \/>\n2. qmail-lspawn<br \/>\n3. qmail-rspawn<br \/>\n4. qmail-clean<br \/>\n5. tcpserver<\/p>\n<p><strong>How Qmail works<\/strong><\/p>\n<p><strong>1. Email arrival in Qmail<\/strong><\/p>\n<p>Mail arrives in Qmail in two different ways.<\/p>\n<p>(i) Locally injected emails.<\/p>\n<p>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.<\/p>\n<p>(ii) Remote emails arrived via SMTP<\/p>\n<p>* tcpserver listens incoming connections on the SMTP port.<br \/>\n* upon a new SMTP connection, qmail-smtpd is launched.<br \/>\n* qmail-smtpd receives emails via SMTP.<\/p>\n<p><strong>2. Queuing emails<\/strong><\/p>\n<p>* qmail-inject &amp; qmail-smpd pass received emails to qmail-queue.<br \/>\n* qmail-queue places emails in the folder \/var\/qmail\/todo<br \/>\n* qmail-queue adds necessary headers to emails<br \/>\n* Then, it notifies qmail-send about newly queued emails.<\/p>\n<p><strong>3. Processing queued emails<\/strong><\/p>\n<p>* qmail-send takes the message out of \/var\/qmail\/queue\/todo folder<br \/>\n* qmail-send checks the recipient address of the email<br \/>\n* If the recipient addres is local, email is passed to qmail-lspwan<br \/>\n* If the recipient address is remote, email is passed to qmail-rspawn<\/p>\n<p><strong>4. Email delivery to local and remote recipients<\/strong><\/p>\n<p>* qmail-lspawn passes email to qmail-local<br \/>\n* qmail-local delivers email to local email address<br \/>\n* qmail-rspawn passes email to qmail-remote<br \/>\n* qmail-remote connects to remote mail server and delivers email to remote email address<\/p>\n<p><strong>5. Cleaning queue after delivering emails<\/strong><\/p>\n<p>* Once all messages are delivered, qmail-send notifies qmail-clean<br \/>\n* qmail-clean removes the delivered emails from the queue<\/p>\n<p><strong>Qmail configuration files<\/strong><\/p>\n<p>Qmail configuration files are located in the folder \/var\/qmail\/control.<\/p>\n<p>1. badmailfrom<br \/>\nAll &#8220;from addresses&#8221; which are blacklisted.<\/p>\n<p>2. bouncefrom<br \/>\nIt is the bounce email from address. Usually it is &#8220;mailer-daemon&#8221;.<\/p>\n<p>3. bouncehost<br \/>\nIt is host name of server<\/p>\n<p>4. concurrencyincoming<br \/>\nMaximum number of simultaneous incoming SMTP connections allowed.<\/p>\n<p>5. concurrencylocal<br \/>\nMaximum number of simultaneous local deliveries<\/p>\n<p>6. concurrencyremote<br \/>\nMaximum number of simultaneous remote deliveries<\/p>\n<p>7. defaultdomain<br \/>\nDefault domain name of server<\/p>\n<p>8. defaulthost<br \/>\nHost name of server<\/p>\n<p>9. databytes<br \/>\nMaximum number of bytes in message (0=no limit)<\/p>\n<p>10. doublebouncehost<br \/>\nIt is the bounce email from address. Usually it is &#8220;mailer-daemon&#8221;.<\/p>\n<p>11. doublebounceto<br \/>\nIt is the bounce email to address. Usually it is &#8220;postmaster&#8221;.<\/p>\n<p>12. helohost<br \/>\nIt is the host name used in SMTP HELO command<\/p>\n<p>13. idhost<br \/>\nIt is host name of server. It is used when creating Message-ID.<\/p>\n<p>13. localiphost<br \/>\nIt is local IP address<\/p>\n<p>14. locals<br \/>\nList of all local domains.<\/p>\n<p>15. me<br \/>\nIt is the hostname of server<\/p>\n<p>16. morercpthosts<br \/>\nOnly 50 domains can be added in rcpthosts, remaining domains should be in morercpthosts.<\/p>\n<p>17. queuelifetime<br \/>\nIt is the number of seconds an email can remain in queue<\/p>\n<p>18. rcpthosts<br \/>\nDomains of all locally hosted email addresses.<\/p>\n<p>19 smtpgreeting<br \/>\nIt is the SMTP greeting message used by mail server.<\/p>\n<p>20. timeoutconnect<br \/>\nTime in seconds, the server has to wait for SMTP connection<\/p>\n<p>21. timeoutremote<br \/>\nTime in seconds, server has to wait for remote server<\/p>\n<p>22. timeoutsmtpd<br \/>\nTime in seconds, server has to wait for SMTP client<\/p>\n<p>23. virtualdomains<br \/>\nList of all virtual domains<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Qmail : How does it work ? <\/p>\n<p>Qmail programs &amp; configuration files 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 &amp; programs, qmail administration will be easier.<\/p>\n<p>Qmail programs<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/914"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=914"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/914\/revisions"}],"predecessor-version":[{"id":916,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/914\/revisions\/916"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}