Sendmail Operation Guide

Queue file formats

This topic describes the format of the queue files. These files live in the directory defined by the Q option in the sendmail.cf file, usually /var/spool/mqueue or /usr/spool/mqueue.

All queue files have the name xfYMDhmsNPPPPP where YMDhmsNPPPPP is the id for this message and the x is a type. The individual letters in the id are:


Y
Encoded year

M
Encoded month

D
Encoded day

h
Encoded hour

m
Encoded minute

s
Encoded second

N
Envelope number

PPPPP
First five digits of the process ID
All files with the same ID collectively define one message. If memory-buffered files are available, some of these files may never appear on disk.

The types are:


d
The data file. The message body (excluding the header) is kept in this file.

q
The queue control file. This file contains the information necessary to process the job.

t
A temporary file. These are an image of the qf file when it is being rebuilt. It should be renamed to a qf file very quickly.

x
A transcript file, existing during the life of a session showing everything that happens during that session.
The qf file is structured as a series of lines each beginning with a code letter. The lines are as follows:

V
The version number of the queue file format, used to allow new sendmail(1M) binaries to read queue files created by older versions. Defaults to version zero. Must be the first line of the file if present. For 8.10 the version number is 4.

H
A header definition. There may be any number of these lines. The order is important: they represent the order in the final message. These use the same syntax as header definitions in the configuration file.

C
The controlling address. The syntax is localuser:aliasname. Recipient addresses following this line will be flagged so that deliveries will be run as the localuser (a user name from the /etc/passwd file); aliasname is the name of the alias that expanded to this address (used for printing messages).

Q
The ``original recipient'', specified by the ORCPT= field in an ESMTP transaction. Used exclusively for Delivery Status Notifications. It applies only to the immediately following R line.

R
A recipient address. This will normally be completely aliased, but is actually realiased when the job is processed. There will be one line for each recipient. Version 1 qf files also include a leading colon-terminated list of flags, which can be:

S
return a message on successful final delivery

F
return a message on failure

D
return a message if the message is delayed

B
indicate that the body should be returned

N
suppress returning the body

P
declare this as a ``primary'' (command line or SMTP-session) address.

S
The sender address. There may only be one of these lines.

T
The job creation time. This is used to compute when to time out the job.

P
The current message priority. This is used to order the queue. Higher numbers mean lower priorities. The priority changes as the message sits in the queue. The initial priority depends on the message class and the size of the message.

M
A message. This line is printed by the mailq(1) command, and is generally used to store status information. It can contain any text.

F
Flag bits, represented as one letter per flag. Defined flag bits are r indicating that this is a response message and w indicating that a warning message has been sent announcing that the mail has been delayed.

N
The total number of delivery attempts.

K
The time (as seconds since January 1, 1970) of the last delivery attempt.

I
The i-number of the data file; this can be used to recover your mail queue after a disastrous disk crash.

$
A macro definition. The values of certain macros.

B
The body type. The remainder of the line is a text string defining the body type. If this field is missing, the body type is assumed to be ``undefined'' and no special processing is attempted. Legal values are 7BIT and 8BITMIME.

Z
The original envelope ID (from the ESMTP transaction). For Deliver Status Notifications only.
As an example, the following is a queue file sent to eric@mammoth.Berkeley.EDU and bostic@okeeffe.CS.Berkeley.EDU:
   P835771
   T404261372
   Seric
   Ceric:sendmail@vangogh.CS.Berkeley.EDU
   Reric@mammoth.Berkeley.EDU
   Rbostic@okeeffe.CS.Berkeley.EDU
   H?P?Return-path: <owner-sendmail@vangogh.CS.Berkeley.EDU>
   HReceived: by vangogh.CS.Berkeley.EDU (5.108/2.7) id AAA06703;
           Fri, 17 Jul 1992 00:28:55 -0700
   HReceived: from mail.CS.Berkeley.EDU by vangogh.CS.Berkeley.EDU (5.108/2.7)
           id AAA06698; Fri, 17 Jul 1992 00:28:54 -0700
   HReceived: from [128.32.31.21] by mail.CS.Berkeley.EDU (5.96/2.5)
           id AA22777; Fri, 17 Jul 1992 03:29:14 -0400
   HReceived: by foo.bar.baz.de (5.57/Ultrix3.0-C)
           id AA22757; Fri, 17 Jul 1992 09:31:25 GMT
   H?F?From: eric@foo.bar.baz.de (Eric Allman)
   H?x?Full-name: Eric Allman
   HMessage-id: <9207170931.AA22757@foo.bar.baz.de>
   HTo: sendmail@vangogh.CS.Berkeley.EDU
   HSubject: this is an example message
This shows the person who sent the message, the submission time (in seconds since January 1, 1970), the message priority, the message class, the recipients, and the headers for the message.
© 2000 The Santa Cruz Operation, Inc. All rights reserved.