Merge from vendor branch OPENPAM:
[dragonfly.git] / contrib / sendmail-8.13.4 / contrib / qtool.8
1 .\" Copyright (c) 1999, 2001-2002 Sendmail, Inc. and its suppliers.
2 .\"      All rights reserved.
3 .\"
4 .\" By using this file, you agree to the terms and conditions set
5 .\" forth in the LICENSE file which can be found at the top level of
6 .\" the sendmail distribution.
7 .\"
8 .\"
9 .\"     $Id: qtool.8,v 8.20 2004/06/28 17:49:41 ca Exp $
10 .\"
11 .TH QTOOL 8 "$Date: 2004/06/28 17:49:41 $"
12 .SH NAME
13 qtool
14 \- manipulate sendmail queues
15 .SH SYNOPSIS
16 .B qtool.pl
17 .RB [options]
18 target_directory source [source ...]
19 .PP
20 .B qtool.pl [-Q][-d|-b]
21 .RB [options]
22 source [source ...]
23 .SH DESCRIPTION
24 .B Qtool
25 moves the queue files used by sendmail between queues. It uses the same
26 locking mechanism as sendmail so can be safely used while sendmail is
27 running.
28 However, it should not be used when queue groups have been configured
29 to move queue files into directories to which they do not belong according
30 to the queue group selections made in the sendmail.cf file.
31 Unless you are absolutely sure you do not interfere with the queue group
32 selection mechanism, do not move queue files around.
33 .PP
34 With no options,
35 .B qtool
36 will move any queue files as specified by \fIsource\fP into
37 \fItarget_directory\fP. \fISource\fP can be either an individual
38 queue control file, a queue file id, or a queue directory.
39 .PP
40 If the -d option is specified, qtool will delete the messages specified by
41 source instead of moving them.
42 .PP
43 If the -b option is specified, the selected messages will be bounced by
44 running sendmail with the -OTimeout.queuereturn=now option.
45 .SS Options
46 .TP
47 \fB\-b\fP
48 Bounce all of the messages specified by source. The messages will be bounced
49 immediately. No attempt will be made to deliver the messages.
50 .TP
51 \fB\-C\fP configfile
52 Specify the sendmail config file.
53 Defaults to /etc/mail/sendmail.cf.
54 .TP
55 \fB\-d\fP
56 Delete all of the messages specified by source.
57 .TP
58 \fB\-e\fP \fIperl_expression\fP
59 Evaluate \fIperl_expression\fP for each queue file as specified
60 by \fIsource\fP. If \fIperl_expression\fP evaluates to true, then that
61 queue file is moved. See below for more detail on \fIperl_expression\fP.
62 .TP
63 \fB\-Q\fP
64 Operate on quarantined items
65 (queue control file begins with hf instead of qf).
66 .TP
67 \fB\-s\fP \fIseconds\fP
68 Move only the queue files specified by \fIsource\fP that have a
69 modification time older than \fIseconds\fP.
70 .SS Perl Expressions
71 You can use any valid perl expression. Inside the expression you have
72 access to a hash that contains many of the fields in the control file as
73 well as some other data about that queued message. The hash is called
74 \fI%msg\fP. If a field has multiple values (e.g. 'Recipient'), it will be
75 returned as an array, otherwise it will be returned as a scalar. Through
76 \fI%msg\fP, you can access the following variables:
77 .TP
78 \fBauth\fP
79 AUTH= parameter.
80 .TP
81 \fBbody_type\fP
82 Body type (\fB8BITMIME\fP, \fB7BIT\fP, or undefined).
83 .TP
84 \fBbody_last_mod_time\fP
85 The last time the body was modified since the epoch in seconds.
86 .TP
87 \fBbody_size\fP
88 The size of the body file in bytes.
89 .TP
90 \fBcontent-length\fP
91 Content-Length: header value (Solaris sendmail only).
92 .TP
93 \fBcontrolling_user\fP
94 The controlling user.
95 .TP
96 \fBcontrol_last_mod_time\fP
97 The last time the control file was modified since the epoch in seconds.
98 .TP
99 \fBcontrol_size\fP
100 The size of the control file in bytes.
101 .TP
102 \fBcreation_time\fP
103 The time when the control file was created.
104 .TP
105 \fBdata_file_name\fP
106 The data file name (deprecated).
107 .TP
108 \fBdeliver_by\fP
109 Deliver by flag and deadline for DELIVERBY ESMTP extension.
110 .TP
111 \fBenvid\fP
112 Original envelope id form ESMTP.
113 .TP
114 \fBerror_recipient\fP
115 The error recipient (deprecated).
116 .TP
117 \fBfinal_recipient\fP
118 Final recipient (for DSNs).
119 .TP
120 \fBflags\fP
121 Array of characters that can be the following values:
122 .PD 0
123 .RS +8
124 .TP 8
125 w
126 warning message has been sent
127 .TP 8
128 r
129 This is an error response or DSN
130 .TP 8
131 8
132 has 8 bit data in body
133 .TP 8
134 b
135 delete Bcc: headers
136 .TP 8
137 d
138 envelope has DSN RET= parameter
139 .TP 8
140 n
141 don't return body
142 .PD
143 .RE
144 .TP
145 \fBheaders\fP
146 This is a Perl hash where the keys are rfc822 field names and the values
147 are rfc822 field values. If a field has only one value it will be returned
148 as a string. If a field has more than one value (e.g. 'Received') it will
149 be returned as a list of strings.
150 .TP
151 \fBinode_number\fP
152 The inode number for the data (body) file.
153 .TP
154 \fBnext_delivery_time\fP
155 Earliest time of next delivery attempt.
156 .TP
157 \fBnum_delivery_attempts\fP
158 Number of delivery attempts that have been made.
159 .TP
160 \fBmacro\fP
161 Defined macro.
162 .TP
163 \fBmessage\fP
164 Envelope status message.
165 .TP
166 \fBoriginal_recipient\fP
167 Original recipient (ORCPT= parameter).
168 .TP
169 \fBpriority\fP
170 Adjusted priority of message.
171 .TP
172 \fBquarantine_reason\fP
173 Quarantine reason for quarantined (held) envelopes.
174 .TP
175 \fBrecipient\fP
176 Array of character flags followed by colon and recipient name. Flags:
177 .PD 0
178 .RS +8
179 .TP 8
180 N
181 Has NOTIFY= parameter.
182 .TP 8
183 S
184 Success DSN requested.
185 .TP 8
186 F
187 Failure DSN requested.
188 .TP 8
189 D
190 Delay DSN requested.
191 .TP 8
192 P
193 Primary address (not the result of alias/forward expansion).
194 .PD
195 .RE
196 .TP
197 \fBsender\fP
198 Sender
199 .TP
200 \fBversion\fP
201 Version of control file.
202 .SH EXAMPLES
203 .TP
204 \fBqtool.pl q2 q1\fP
205 Moves all of the queue files in queue q1 to queue q2.
206 .TP
207 \fBqtool.pl q2 q1/d6CLQh100847\fP
208 Moves the message with id d6CLQh100847 in queue q1 to queue q2.
209 .TP
210 \fBqtool.pl q2 q1/qfd6CLQh100847\fP
211 Moves the message with id d6CLQh100847 in queue q1 to queue q2.
212 .TP
213 \fBqtool.pl -e '$msg{num_delivery_attempts} == 3' /q2 /q1\fP
214 Moves all of the queue files that have had three attempted deliveries from
215 queue q1 to queue q2.
216 .SH BUGS
217 In sendmail 8.12, it is possible for a message's queue and data files (df)
218 to be stored in different queues.
219 In this situation, you must give qtool the pathname of the queue file,
220 not of the data file (df).
221 To be safe, never feed qtool the pathname of a data file (df).
222 .SH SEE ALSO
223 sendmail(8)
224 .SH HISTORY
225 The
226 .B qtool
227 command appeared in
228 sendmail 8.10.