-
-
Notifications
You must be signed in to change notification settings - Fork 3
qmail local.8
qmail-local - deliver or forward a mail message
qmail-local [ -nN ] user homedir local dash ext domain sender defaultdelivery qqeh
qmail-local(8) reads a mail message and delivers it to user by the procedure described in dot-qmail(5).
The message's envelope recipient is local@domain. qmail-local(8) records local@domain in a new Delivered-To header field. If exactly the same Delivered-To: local@domain already appears in the header, qmail-local(8) bounces the message to prevent mail forwarding loops. If maxdeliveredto is a value greater than the number of exact local@domain matches, then delivery progresses. If maxdeliveredto is -1 then this stage goes unchecked.
The message's envelope sender is sender. qmail-local(8) records sender in a new Return-Path header field.
homedir is the user's home directory. It must be an absolute directory name.
dash and ext identify the .qmaildashext file used by qmail-local(8) ; See dot-qmail(5). Normally dash is either empty or a lone hyphen. If it is empty, qmail-local(8) treats a nonexistent .qmailext the same way as an empty .qmailext : namely, following the delivery instructions in defaultdelivery. If ext ends with the string literal "default", then qmail-local(8) sets the environment variable DEFAULT to the string "default". This environment variable can be used by fastforward(1) in a dot-qmail(5) file to use the -d flag and use default@$HOST as the recipient. Without this environment variable set, fastforward can use $EXT@$HOST as the recipient. Typical use of this would be use .qmail-default in /var/indimail/alias directory to handle default for unknown addresses.
The contents of qqeh is prepended to the message on standard input. It is used to add extra headers to an existing message.
The standard input for qmail-local(8) must be a seekable file, so that qmail-local(8) can read it more than once.
qmail-local(8) gets called by qmail-lspawn(8) usually. One can also configure qmail-lspawn(8) to call spawn-filter(8) before qmail-local(8). This is done by setting QMALLOCAL environment variable. spawn-filter(8) can carry out filtering and set few recipient specific environment variables using envrules. Thus, one can customize qmail-local(8) behaviour to be recipient specific.
If Sender Rewriting Scheme (SRS) has been configured, when forwarding (due to instructions in a dot-qmail(5) file), qmail-local(8) rewrites the sender. See indimail-srs(5) for information on how to do this.
If the environment variable USE_FSYNC or USE_FDATASYNC is set, then qmail-local(8) writes all data to disk ("flushes") all modified in-core data of (i.e., modified buffer cache pages for) the new message to the disk device (or other permanent storage device) so that all changed information can be retrieved even if the system crashes or is rebooted. This includes writing through or flushing a disk cache if present. The call blocks until the device reports that the transfer has completed. The system calls fsync(2) or fdatasync(2) are used to flush data to disk. Though fdatasync(2) is faster than fsync(2), both these calls impose a penalty on performance.
If the environment variable USE_SYNCDIR is enabled, qmail-local(8) forces BSD style directory syncing.
The environment variable USE_FSYNC, USE_FDATASYNC, USE_SYNCDIR is controlled by qmail-send(8) / todo-proc(8).
If the environment variable SANITIZE_ENV is enabled qmail-local will first clear all environment variables other than MESSID, USE_FSYNC, USE_FDATASYNC, USE_SYNCDIR. You can set additional environment variables to preserve by setting SANITIZE_ENV as a colon ':' separated list of environment variables to retain. The purpose of SANITIZE_ENV is to ensure programs run using dot-qmail(5) will run without any environment variable inherited from the startup scripts.
-n
Instead of reading and delivering the message, print a description of
the delivery instructions.
-N
(Default.) Read and deliver the message.
qmail-local(8) by default looks in /etc/indimail/control directory for all control files. This path can be changed by defining the CONTROLDIR environment variable.
localdomains
List of domains considered as local. If the user's home directory has a
file .localdomains or if the environment variable LOCALDOMAINS,
is defined qmail-local(8) will deliver the mail only if it comes
from any of the domain listed in localdomains. This restricts users
to receive local mails only.
0 if the delivery is completely successful, 5 if out of disk quota; nonzero if any delivery instruction failed. Exit code 111 indicates temporary failure.
dot-qmail(5), indimail-srs(5), envelopes(5), qmail-command(8), qmail-queue(8), qmail-send(8), spawn-filter(8), qmail-lspawn(8), fsync(2)