Skip to content

qmail direct.8

Manvendra Bhangui edited this page Feb 25, 2024 · 3 revisions

NAME

qmail-direct - deliver mail message directly to Maildir

SYNOPSIS

qmail-direct

DESCRIPTION

qmail-direct reads a mail message from descriptor 0. It then reads envelope information from descriptor 1. It places the message directly into user's Maildir directory. The user is the value of USER environment variable. For getting the user's Maildir directory, qmail-direct uses getpwnam(3) from glibc(7). It can use qgetpwnam(3) if the environment variable USE_QPWGR is set.

The envelope information is an envelope sender address followed by a list of envelope recipient addresses. The sender address is preceded by the letter F and terminated by a 0 byte. qmail-direct writes the sender address as the Return-Path header. Each recipient address is preceded by the letter T and terminated by a 0 byte. The list of recipient addresses is terminated by an extra 0 byte. qmail-direct writes X-Recipients header as a comma separated list of recipients. If qmail-direct sees end-of-file before the extra 0 byte, it aborts without delivering the message.

Every envelope recipient address should contain a username, an @ sign, and a fully qualified domain name.

qmail-direct always adds a Return-Path, X-Recipients, and Received line to the top of the message. Other than this, qmail-direct does not inspect the message and does not enforce any restrictions on its contents. However, the recipients probably expect to see a proper header, as described in qmail-header(5).

Programs included with qmail which use QMAILQUEUE will invoke qmail-direct when QMAILQUEUE is set to /usr/sbin/qmail-direct. See qmail-queue(8) and indimail-env(5) to know which programs use QMAILQUEUE.

qmail-direct allows you to deliver mails without requiring resource intnsive services and processes to manage queues and deliveries. It is useful on single board computers where you might want to conserve the CPU as much as possible but want mails generated on the system to get directly delivered to users without requiring you to run complicated daemons.

qmail-direct can deliver to any user when run as uid 0. For any other user to deposit mails, the setuid bit needs to be set to root for qmail-direct executable.

qmail-direct sets an alarm of 86400 seconds to quit if it doesn't complete. This can be changed by setting DEATH environment variable. See the man pages for qmail-queue(8) and indimail-mta-internals(7) for more details.

EXIT CODES

qmail-direct does not print diagnostics. It exits 0 if it has successfully queued the message. It exits between 1 and 99 if it has failed to deliver the message.

All qmail-direct error codes between 11 and 40 indicate permanent errors:

11
Address too long.

51
Out of memory.

52
Timeout.

53
Write error; e.g., disk full.

54
Unable to read the message or envelope.

55
Unable to read a configuration file.

61
Problem with the indimail or user's home directory.

63
Problem with Maildir/tmp/pid.

64
Problem with Maildir/tmp/fnnum.b. Here fnnum is the inode number of Maildir/tmp/pid

65
Problem with Maildir/tmp/fnnum.h. Here fnnum is the inode number of Maildir/tmp/pid

81
Internal bug; e.g., segmentation fault.

91
Envelope format error.

SEE ALSO

getpwnam(3) qgetpwnam(3), addresses(5), envelopes(5), qmail-header(5), qmail-inject(8), qmail-queue(8), qmail-qmqpc(8), qmail-nullqueue(8), qmail-multi(8), indimail-mta-internals(7),

Clone this wiki locally