debian/rules: Use `git' potty wrapper.
[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 .SH "EXIT CODES"
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
52 Currently 64, 65, 70, 76, 77, 78, and 112 are considered hard errors,
53 and all other codes are considered soft errors,
54 but
55 .I command
56 should avoid relying on this.
57 .SH "ENVIRONMENT VARIABLES"
58 .B qmail-local
59 supplies several useful environment variables to
60 .IR command .
61 .B WARNING:
62 These environment variables are not quoted.
63 They may contain special characters.
64 They are under the control of a possibly malicious remote user.
65
66 .B SENDER
67 is the envelope sender address.
68 .B NEWSENDER
69 is the forwarding envelope sender address,
70 as described in
71 .BR dot-qmail(5) .
72 .B RECIPIENT
73 is the envelope recipient address,
74 .IR local@domain .
75 .B USER
76 is
77 .IR user .
78 .B HOME
79 is your home directory,
80 .IR homedir .
81 .B HOST
82 is the
83 .I domain
84 part of the recipient address.
85 .B LOCAL
86 is the
87 .I local
88 part.
89 .B EXT
90 is the
91 address extension,
92 .IR ext .
93
94 .B HOST2
95 is the portion of
96 .B HOST
97 preceding the last dot;
98 .B HOST3
99 is the portion of
100 .B HOST
101 preceding the second-to-last dot;
102 .B HOST4
103 is the portion of
104 .B HOST
105 preceding the third-to-last dot.
106
107 .B EXT2
108 is the portion of
109 .B EXT
110 following the first dash;
111 .B EXT3
112 is the portion
113 following the second dash;
114 .B EXT4
115 is the portion
116 following the third dash.
117 .B DEFAULT
118 is the portion
119 corresponding to the
120 .B default
121 part of the
122 .BR .qmail\- ...
123 file name;
124 .B DEFAULT
125 is not set if
126 the file name does not end with
127 .BR default .
128
129 .B DTLINE
130 and
131 .B RPLINE
132 are the usual
133 .B Delivered-To
134 and
135 .B Return-Path
136 lines,
137 including newlines.
138 .B UFLINE
139 is the UUCP-style
140 .B From_
141 line that
142 .B qmail-local
143 adds to
144 .IR mbox -format
145 files.
146 .SH "SEE ALSO"
147 dot-qmail(5),
148 envelopes(5),
149 qmail-local(8)