Scroll to navigation

QTOOL(8) System Manager's Manual QTOOL(8)


qtool - manipulate sendmail queues

SYNOPSIS [options] target_directory source [source ...] [-Q][-d|-b] [options] source [source ...]


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. However, it should not be used when queue groups have been configured to move queue files into directories to which they do not belong according to the queue group selections made in the file. Unless you are absolutely sure you do not interfere with the queue group selection mechanism, do not move queue files around.

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.


Bounce all of the messages specified by source. The messages will be bounced immediately. No attempt will be made to deliver the messages.
Specify the sendmail config file. Defaults to /etc/mail/
Delete all of the messages specified by source.
Evaluate 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.
Operate on quarantined items (queue control file begins with hf instead of qf).
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= parameter.
Body type (8BITMIME, 7BIT, or undefined).
The last time the body was modified since the epoch in seconds.
The size of the body file in bytes.
Content-Length: header value (Solaris sendmail only).
The controlling user.
The last time the control file was modified since the epoch in seconds.
The size of the control file in bytes.
The time when the control file was created.
The data file name (deprecated).
Deliver by flag and deadline for DELIVERBY ESMTP extension.
Original envelope id form ESMTP.
The error recipient (deprecated).
Final recipient (for DSNs).
Array of characters that can be the following values:
warning message has been sent
This is an error response or DSN
has 8 bit data in body
delete Bcc: headers
envelope has DSN RET= parameter
don't return body
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.
The inode number for the data (body) file.
Earliest time of next delivery attempt.
Number of delivery attempts that have been made.
Defined macro.
Envelope status message.
Original recipient (ORCPT= parameter).
Adjusted priority of message.
Quarantine reason for quarantined (held) envelopes.
Array of character flags followed by colon and recipient name. Flags:
Has NOTIFY= parameter.
Success DSN requested.
Failure DSN requested.
Delay DSN requested.
Primary address (not the result of alias/forward expansion).
Version of control file.


Moves all of the queue files in queue q1 to queue q2.
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
Moves all of the queue files that have had three attempted deliveries from queue q1 to queue q2.


In sendmail 8.12, it is possible for a message's queue and data files (df) to be stored in different queues. In this situation, you must give qtool the pathname of the queue file, not of the data file (df). To be safe, never feed qtool the pathname of a data file (df).




The qtool command appeared in sendmail 8.10.

$Date: 2013-11-22 20:51:18 $