SYNOPSIS
qtool.pl [options] target_directory source [source ...]qtool.pl [-Q][-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. 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 sendmail.cf 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.
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.
- -C configfile
- Specify the sendmail config file. Defaults to /etc/mail/sendmail.cf.
- -d
- Delete all of the messages specified by source.
- -e perl_expression
- 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.
- -Q
- Operate on quarantined items (queue control file begins with hf instead of qf).
- -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.
- content-length
- Content-Length: header value (Solaris sendmail only).
- controlling_user
- The controlling user.
- control_last_mod_time
- The last time the control file 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).
- deliver_by
- Deliver by flag and deadline for DELIVERBY ESMTP extension.
- envid
- Original envelope id form ESMTP.
- error_recipient
- The error recipient (deprecated).
- final_recipient
- Final recipient (for DSNs).
- flags
-
Array of characters that can be the following values:
-
- w
- warning message has been sent
- r
- This is an error response 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.
- quarantine_reason
- Quarantine reason for quarantined (held) envelopes.
- 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 -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.
BUGS
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).HISTORY
The qtool command appeared in sendmail 8.10.