man qtool (Administration système) - qtool - manipulate sendmail queues

NAME

qtool - manipulate sendmail queues

SYNOPSIS

qtool.pl [options] target_directory source [source ...]

qtool.pl [-d/-b] [options] source [source ...]

DESCRIPTION

Qtool moves the queue files used by sendmail between queues. It uses the same locking mechanism as sendmail so can be safely used while sendmail is running.

With no options, qtool will move any queue files as specified by source into target_directory. Source can be either an individual queue control file, a queue file id, or a queue directory.

If the -d option is specified, qtool will delete the messages specified by source instead of moving them.

If the -b option is specified, the selected messages will be bounced by running sendmail with the -OTimeout.queuereturn=now option.

Options

-b
Bounce all of the messages specified by source. The messages will be bounced immediately. No attempt will be made to deliver the messages.
-d
Delete all of the messages specified by source.
-e perl_expression
Evalute perl_expression for each queue file as specified by source. If perl_expression evaluates to true, then that queue file is moved. See below for more detail on perl_expression.
-s seconds
Move only the queue files specified by source that have a modification time older than seconds.

Perl Expressions

You can use any valid perl expression. Inside the expression you have access to a hash that contains many of the fields in the control file as well as some other data about that queued message. The hash is called %msg. If a field has multiple values (e.g. 'Recipient'), it will be returned as an array, otherwise it will be returned as a scalar. Through %msg, you can access the following variables:

auth
AUTH= parameter.
body_type
Body type (8BITMIME, 7BIT, or undefined).
body_last_mod_time
The last time the body was modified since the epoch in seconds.
body_size
The size of the body file in bytes.
charset
Character set (for future use).
content-length
Content-Length: header value (Solaris sendmail only).
controlling_user
The controlling user.
control_last_mod_time
The last time the body was modified since the epoch in seconds.
control_size
The size of the control file in bytes.
creation_time
The time when the control file was created.
data_file_name
The data file name (deprecated).
envid
Original envelope id form ESMTP.
error_recipient
The error recipient (deprecated).
flags
Array of characters that can be the following values:
w
warning message has been sent
r
This is an error respone or DSN
8
has 8 bit data in body
b
delete Bcc: headers
d
envelope has DSN RET= parameter
n
don't return body
headers
This is a Perl hash where the keys are rfc822 field names and the values are rfc822 field values. If a field has only one value it will be returned as a string. If a field has more than one value (e.g. 'Received') it will be returned as a list of strings.
inode_number
The inode number for the data (body) file.
next_delivery_time
Earliest time of next delivery attempt.
num_delivery_attempts
Number of delivery attempts that have been made.
macro
Defined macro.
message
Envelope status message.
original_recipient
Original recipient (ORCPT= parameter).
priority
Adjusted priority of message.
recipient
Array of character flags followed by colon and recipient name. Flags:
N
Has NOTIFY= parameter.
S
Success DSN requested.
F
Failure DSN requested.
D
Delay DSN requested.
P
Primary address (not the result of alias/forward expansion).
sender
Sender
version
Version of control file.

EXAMPLES

qtool.pl q2 q1
Moves all of the queue files in queue q1 to queue q2.
qtool.pl q2 q1/d6CLQh100847
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
qtool.pl q2 q1/qfd6CLQh100847
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
qtool.pl q2 q1/dfd6CLQh100847
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
qtool.pl -e '$msg{num_delivery_attempts} == 3' /q2 /q1
Moves all of the queue files that have had three attempted deliveries from queue q1 to queue q2.

SEE ALSO

HISTORY

The qtool command appeared in sendmail 8.10.