Upstream qmail 1.01
[qmail] / qmail-command.8
1 .TH qmail-command 8
2 .SH NAME
3 qmail-command \- user-specified mail delivery program
4 .SH SYNOPSIS
5 in
6 .BR .qmail\fIext :
7 .B |\fIcommand
8 .SH DESCRIPTION
9 .B qmail-local
10 will, upon your request,
11 feed each incoming mail message through a program of your choice.
12
13 When a mail message arrives,
14 .B qmail-local
15 runs
16 .B sh -c \fIcommand
17 in your home directory.
18 It makes the message available on
19 .IR command 's
20 standard input.
21
22 .B WARNING:
23 The mail message does not begin with
24 .BR qmail-local 's
25 usual
26 .B Return-Path
27 and
28 .B Delivered-To
29 lines.
30
31 Note that
32 .B qmail-local
33 uses the same file descriptor for every delivery
34 in your
35 .B .qmail
36 file, so it is not safe for
37 .I command
38 to fork a child that
39 reads the message in the background while the parent exits.
40
41 .IR command 's
42 exit codes are interpreted as follows:
43 0 means that the delivery was successful;
44 99 means that the delivery was successful,
45 but that
46 .B qmail-local
47 should ignore all further delivery instructions;
48 100 means that the delivery failed permanently (hard error);
49 111 means that the delivery failed but should be tried again
50 in a little while (soft error).
51 Currently 64, 65, 70, 76, 77, 78, and 112 are considered hard errors,
52 and all other codes are considered soft errors,
53 but
54 .I command
55 should avoid relying on this.
56
57 .B qmail-local
58 supplies several useful environment variables to
59 .IR command .
60 .B SENDER
61 is the envelope sender address.
62 .B NEWSENDER
63 is the forwarding envelope sender address,
64 as described in
65 .BR dot-qmail(5) .
66 .B RECIPIENT
67 is the envelope recipient address,
68 .IR local@domain .
69 .B USER
70 is
71 .IR user .
72 .B HOME
73 is your home directory,
74 .IR homedir .
75 .B HOST
76 is the
77 .I domain
78 part of the recipient address.
79 .B LOCAL
80 is the
81 .I local
82 part.
83 .B EXT
84 is the
85 .B .qmail
86 extension,
87 .IR ext .
88 .B EXT2
89 is the portion of
90 .B EXT
91 following the first dash;
92 .B EXT3
93 is the portion
94 following the second dash;
95 .B EXT4
96 is the portion
97 following the third dash.
98 .B DTLINE
99 and
100 .B RPLINE
101 are the usual
102 .B Delivered-To
103 and
104 .B Return-Path
105 lines,
106 including newlines.
107 .B UFLINE
108 is the UUCP-style
109 .B From_
110 line that
111 .B qmail-local
112 adds to
113 .IR mbox -format
114 files.
115
116 .B WARNING:
117 These environment variables are not quoted.
118 They may contain special characters.
119 They are under the control of a possibly malicious remote user.
120 .SH "SEE ALSO"
121 dot-qmail(5),
122 envelopes(5),
123 qmail-local(8)