8. Local Delivery
Local delivery is considered to be the transfer of a received email to a local INBOX of a known email account in the local system from the MTA's queue. This is subject and responsibility of a Local Delivery Agent (LDA). In case of s/qmail this delivery can be multi-staged; both on a system level, as well on a virtual domain or personal account level.
After injecting the email in s/qmail queue, it is treated depending on the domain information given in the Rcpt To: <user@doman.tld> SMTP envelope field according to two mechanisms considering
- locals
- virtualdomains.
To deliver those mails to the users, two processes are responsible for the delivery:
- qmail-lspawn and
- qmail-local.
qmail-lspawn is a system process and is enabled to provide an additional s/qmail system's user mapping.
Rather, qmail-local can be advised to include a user-defined second stage delivery process. Here a user can setup:
- filtering of messages and their content,
- forwarding of emails to other accounts (local and remote)
- invoking other delivery agents like procmail or dovecot or others,
- defining the delivery target and format, like mbox or Maildir.
If nothing particular is provided, the systems defaultdelivery takes place.
Email addresses are thus subject of rewriting the original SMTP recipient facilitad upon recognition those as virtualdomain address. Depending on the rewriting, emails - the message - needs to be stored. In general, emails are treated as files in the following ways:
- They are stored on the local file system,
- they stored on a remote file system mounted by means of NFS, SMB, or other mechanism making the file system appear to exist locally,
- they could be transferred to a remote file system upon receipt.
Persistent storage of email messages follows typically the following formating rules:
- The message is stored in a concatinated file, called a mbox in the user's home directory,
- the email messages are stored in the recipient's directory as individual files following D.J.B.'s maildir format (which can be extended as maildir++),
- the message is stored on a common space in the file system known as VSM (var-spool-mail) in the mbox format.
qmail-local supports a variety of mechanisms; known as
- defaultdelivery as defined by qmail-start,
- individual settings by a local user as provided in a .qmail file,
- instructions for local unrecognized accounts treated by qmail's alias user according to an existing .qmail(-default) file.
8.1 Acceptance of mails targeting local Accounts
In the s/qmail system, acceptance for emails to local accounts happens under two different conditions, and depends whether the email was generated locally or received from an external system.
8.1.1 Remote Acceptance for local delivery
In the s/qmail system email arrive from an external originator ('Mail From:' targeting a local recipient ('Rcpt to:') while using
- (E)SMTP(S) services provided by qmail-smtpd or
- QMTP(S) services provided by qmail-qmtpd services
while employing the control files:
- rcpthosts, morecpthosts.cdb and
- recipients
- QMQP service qmail-qmqpd depend on the setting of the tcpserver environment variables only.
8.1.2 Local injection
However, emails can be generated locally by means of
- qmail-inject,
- mailsubj, and
- sendmail
and those are not subject of verification; rather they are delivered locally immediately (in case a local address is targeted).
8.1.3 QMQPD injection
Further, emails received via qmail-qmqpd are treated like locally send mails too.
8.1.4 Bounce mails for local delivery
8.2 Email accounts
We now need to identify in the first place, who can eventually receive email, thus is qualified for reception. Email recipient accounts in the s/qmail system may be distinguished as:
- Local managed accounts:
- Local Unix user
- s/qmail 'alias' mechanism
- s/qmail 'assigned' user
- Virtual managed accounts:
- VPopMail
- VMailMgr
- Remote managed accounts:
- Dovecot
- Mailing Lists
- EZMLM
Environment variables:
Local managed accounts
Locally assigned accounts
The s/qmail 'alias' user
Virtual accounts
8.3 Delivering Emails
8.4 s/qmail Alias and System Users
User 'alias' and 'alias' users:
8.5 Virtual domain users
8.6 Dot-qmail Mechanism
Mail container:
- Maildir
- mbox
- VSM
Quotas:
dot-qmail mechanism:
8.7 Mail Repository
Storage for User mails
Location: