exipick - display messages from Exim queue based on a variety of criteria exipick [--help|--version] | [-spool <spool>] [-and|-or] [-bp|-bpa|-bpc|-bpr|-bpra|-bpru|-bpu] [<criterion> [<criterion> ...]] exipick is designed to display the contents of a Exim mail spool based on user-specified criteria. It is designed to mimic the output of 'exim -bp' (or any of the other -bp* options) and Exim's spec.txt should be used to learn more about the exact format of the output. The criteria are formed by creating comparisons against characteristics of the messages, for instance message_size, sender_helo_name, or message_headers. The path to exim's spool directory. In general usage you should set the $spool variable in the script to your site's main spool directory, but this option is useful for alternate installs, or installs on -1NFS servers, etc. A message will be displayed only if it matches all of the specified criteria. This is the default. A message will be displayed if it matches any of the specified criteria. By default criteria using the '=' operator are caseless. Specifying this option make them respect case. Please see Exim's spec.txt for details on the format and information displayed with each option. Please see the 'exiqgrep' documentation for more details on the behaviour and output format produced by these options The criteria are used to determine whether or not a given message should be displayed. The criteria are built using variables containing information about the individual messages (see -1VARIABLES section for list and descriptions of available variables). Each criterion is evaluated for each message in the spool and if all (by default) criteria match or (if -or option is specified) any criterion matches, the message is displayed. See -1VARIABLE -1TYPES for explanation of types of variables and the evaluations that can be performed on them and -1EXAMPLES section for complete examples. The format of a criterion is explained in detail below, but a key point to make is that the variable being compared must always be on the left side of the comparison. If no criteria are provided all messages in the queue are displayed (in this case the output of exipick should be identical to the output of 'exim -bp') This screen. Version info. Although there are variable types defined, they are defined only by the type of data that gets put into them. They are internally typeless. Because of this it is perfectly legal to perform a numeric comparison against a string variable, although the results will probably be meaningless. Variable of the numeric type can be of integer or float. Valid comparisons are <, <=, >, >=, ==, and !=. The numbers specified in the criteria can have a suffix of d, h, m, s, M, K, or B, in which case the number will be mulitplied by 86400, 3600, 60, 1, 1048576, 1024, or 1 respectively. These suffixes are case sensitive. While these are obviously designed to aid in date and size calculations, they are not restricted to variables of their respective types. Variables of the boolean type are very easy to use in criteria. The format is either the variable by itself or the variable negated with a ! sign. For instance, 'deliver_freeze' matches if the message in question is frozen, '!deliver_freeze' matches if message is not frozen. String variables are basically defined as those that are neither numeric nor boolean and can contain any data. There are several types of comparisons that can be made against string variables. With the exception of '=', the operators all match the functionality of the like-named perl operators. The simplest form is a bare string regular expression, represented by the operator '='. The value used for the comparison will be evaluated as a regular expression and can be as simple or as complex as desired. For instance 'sender_helo_name = example' on the simple end or 'sender_helo_name = ^aol\.com$' on the more complex end. This comparison is caseless by default. See --caseful option. Slightly more complex is the string comparison with the operators 'eq' and 'ne' for equal and not equal, respectively. 'sender_helo_name eq hotmail.com' is true for messages with the exact helo string "hotmail.com", while 'sender_helo_name ne hotmail.com' is true for any message any helo string other than hotmail.com. The most complex and the most flexible format are straight regular expressions with the operators =~ and !~. The value in the criteria is expected to be a correctly formatted perl regular expression including the regexp delimiters (usually //). The criterion 'sender_helo_name !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/' matches for any message which does not have an -1IP address for its helo string. With a few exceptions the available variables match Exim's internal expansion variables in both name and exact contents. There are a few notable additions and format deviations which are noted below. Although a brief explanation is offered below, Exim's spec.txt should be consulted for full details. It is important to remember that not every variable will be defined for every message. For example, sender_host_port is not defined for messages not received from a remote host. In the list below, '.' denotes standard messages with contents matching Exim's variable, '#' denotes standard variables with non-standard contents, and '+' denotes a non-standard variable.

Boolean variables
-1TRUE if unqualified recipient addresses are permitted in header lines. -1TRUE if unqualified sender addresses are permitted in header lines. -1TRUE if the message is frozen. -1TRUE if the message has not been deferred. -1TRUE when the message has been manually thawed. -1TRUE if, under normal circumstances, Exim will not try to deliver the message. -1TRUE if there was an attempt to look up the host's name from its -1IP address, but the attempt failed. -1TRUE if the message is a locally-generated error message. -1TRUE if the message was locally generated. -1TRUE if the envelope sender of this message was set by an untrusted local caller. -1TRUE if a -1TLS certificate was verified when the message was received.

Numeric variables
The number of lines in the message's body. The number of binary zero bytes in the message's body. The epoch time at which message was frozen. The local port number if network-originated messages. The number of seconds since the message was received. The size of the body in bytes. The size of the message in bytes. The group id under which the process that called Exim was running as when the message was received. The user id under which the process that called Exim was running as when the message was received. The number of Received: header lines in the message. The epoch time at which the message was received. The number of envelope recipients for the message. The number of envelope recipients for the message which have already been delivered. Note that this is the count of original recipients to which the message has been delivered. It does not include generated addresses so it is possible that this number will be less than the number of addresses in the recipients_del string. The number of envelope recipients for the message which have not yet been delivered. The port number that was used on the remote host for network-originated messages. The number of delay warnings which have been sent for this message.

String variables
User definable variables. Optional saved information from authenticators, or the login name of the calling process for locally submitted messages. The value of AUTH= param for smtp messages, or a generated value from the calling processes login and qualify domain for locally submitted messages. The value of the same named message header, for example header_to or header_reply-to. These variables are really closer to Exim's rheader_* variables, with the exception that leading and trailing space is removed. The address of the local -1IP interface for network-originated messages. The text returned by the local_scan() function when a message is received. The message's body. Unlike Exim's variable of the same name, this variable contains the entire message body. The logic behind this is that the message body is not read unless it is specifically referenced, so under normal circumstances it is not a penalty, but when you need the entire body you need the entire body. Like Exim's copy, newlines and nulls are replaced by spaces. A concatenation of all the header lines except for lines added by routers or transports. The unique message id that is used by Exim to identify the message. The login of the process which called Exim. The name of the protocol by which the message was received. The list of envelope recipients for a message. Unlike Exim's version, this variable always contains every envelope recipient of the message. The recipients are separated by a comma and a space. The list of delivered envelope recipients for a message. This non-standard variable is in the same format as recipients and contains the list of already-delivered recipients including any generated addresses. The list of undelivered envelope recipients for a message. This non-standard variable is in the same format as recipients and contains the list of undelivered recipients. The contents of the Reply-To: header line if one exists and it is not empty, or otherwise the contents of the From: header line. The sender's address that was received in the message's envelope. For bounce messages, the value of this variable is the empty string. The domain part of sender_address. The local part of sender_address. The -1HELO or -1EHLO value supplied for smtp or bsmtp messages. The remote host's -1IP address. The name of the authenticator driver which successfully authenticated the client from which the message was received. The remote host's name as obtained by looking up its -1IP address. The identification received in response to an -1RFC 1413 request for remote messages, the login name of the user that called Exim for locally generated messages. The cipher suite that was negotiated for encrypted -1SMTP connections. The value of the Distinguished Name of the certificate if Exim is configured to request one. Display only frozen messages. Display only messages wich were delivered over an authenticated smtp session in the last 20 minutes. Display a count of messages in the queue which are over 200 kilobytes in size. Display message which have a -1HELO string which either is an -1IP address or contains an underscore. None that I know of, except an Exim installation. Your life will also be a lot easier if you set $spool at the top of the script to your install's spool directory. Although I conceived of the concept for this program independently, the name 'exipick' was taken from the Exim WishList and was suggested by Jeffrey Goldberg. Thank you to Philip Hazel for writing Exim. Of course this program exists because of Exim, but more specifically the message parsing code is based on Exim's and some of this documentation was copy/pasted from Exim's.