qmail-header.5
changeset 0 068428edee47
equal deleted inserted replaced
-1:000000000000 0:068428edee47
       
     1 .TH qmail-header 5
       
     2 .SH NAME
       
     3 qmail-header \- format of a mail message
       
     4 .SH OVERVIEW
       
     5 At the top of every mail message is a
       
     6 highly structured
       
     7 .BR header .
       
     8 Many programs expect the header to carry certain information,
       
     9 as described below.
       
    10 The main function of
       
    11 .B qmail-inject
       
    12 is to make sure that each outgoing message has an appropriate header.
       
    13 
       
    14 For more detailed information, see
       
    15 .BR http://pobox.com/~djb/proto/immhf.html .
       
    16 .SH "MESSAGE STRUCTURE"
       
    17 A message contains a series of
       
    18 .I header fields\fR,
       
    19 a blank line,
       
    20 and a
       
    21 .IR body :
       
    22 
       
    23 .EX
       
    24      Received: (qmail-queue invoked by uid 666);
       
    25 .br
       
    26 	     30 Jul 1996 11:54:54 -0000
       
    27 .br
       
    28      From: djb@silverton.berkeley.edu (D. J. Bernstein)
       
    29 .br
       
    30      To: fred@silverton.berkeley.edu
       
    31 .br
       
    32      Date: 30 Jul 1996 11:54:54 -0000
       
    33 .br
       
    34      Subject: Go, Bears!
       
    35 .br
       
    36 
       
    37 .br
       
    38      I've got money on this one.  How about you?
       
    39 .br
       
    40 
       
    41 .br
       
    42      ---Dan   (this is the third line of the body)
       
    43 .EE
       
    44 
       
    45 Each header field has a
       
    46 .IR name ,
       
    47 a colon,
       
    48 some
       
    49 .IR contents ,
       
    50 and a newline:
       
    51 
       
    52 .EX
       
    53      Subject: Go, Bears!
       
    54 .EE
       
    55 
       
    56 The field contents may be folded across several lines.
       
    57 Each line past the first must begin with a space or tab:
       
    58 
       
    59 .EX
       
    60      Received: (qmail-queue invoked by uid 666);
       
    61 .br
       
    62 	     30 Jul 1996 11:54:54 -0000
       
    63 .EE
       
    64 
       
    65 The field name must not contain spaces, tabs, or colons.
       
    66 Also, an empty field name is illegal.
       
    67 .B qmail-inject
       
    68 does not allow field names with unprintable characters.
       
    69 
       
    70 Case is irrelevant in field names:
       
    71 .B subject
       
    72 and
       
    73 .B SUBJECT
       
    74 and
       
    75 .B SuBjEcT
       
    76 have the same meaning.
       
    77 .SH "ADDRESS LISTS"
       
    78 Certain fields, such as
       
    79 .BR To ,
       
    80 contain
       
    81 .I address lists\fR.
       
    82 
       
    83 An address list contains some number of
       
    84 .I addresses
       
    85 or
       
    86 .I address groups\fR,
       
    87 separated by commas:
       
    88 
       
    89 .EX
       
    90      a@b, c@d (Somebody), A Person <e@f>,
       
    91 .br
       
    92         random group: g@h, i@j;, k@l
       
    93 .EE
       
    94 
       
    95 An
       
    96 .I address group
       
    97 has some text, a colon, a list of addresses,
       
    98 and a semicolon:
       
    99 
       
   100 .EX
       
   101         random group: g@h, i@j;
       
   102 .EE
       
   103 
       
   104 An address can appear in several forms.
       
   105 The most common form is
       
   106 .IR box@host .
       
   107 
       
   108 Every address must include a host name.
       
   109 If
       
   110 .B qmail-inject
       
   111 sees a lone box name
       
   112 it adds the
       
   113 .I default host name\fR.
       
   114 
       
   115 All host names should be fully qualified.
       
   116 .B qmail-inject
       
   117 appends the
       
   118 .I default domain name
       
   119 to any name without dots:
       
   120 
       
   121 .EX
       
   122      djb@silverton  ->  djb@silverton.berkeley.edu
       
   123 .EE
       
   124 
       
   125 It appends the
       
   126 .I plus domain name
       
   127 to any name
       
   128 that ends with a plus sign:
       
   129 
       
   130 .EX
       
   131      eric@mammoth.cs+  ->  eric@mammoth.cs.berkeley.edu
       
   132 .EE
       
   133 
       
   134 A host name may be a dotted-decimal address:
       
   135 
       
   136 .EX
       
   137      djb@[128.32.183.163]
       
   138 .EE
       
   139 
       
   140 RFC 822 allows mailbox names inside angle brackets
       
   141 to include
       
   142 .I source routes\fR,
       
   143 but
       
   144 .B qmail-inject
       
   145 strips all source routes out of addresses.
       
   146 .SH "SENDER ADDRESSES"
       
   147 .B qmail-inject
       
   148 looks for sender address lists in the following fields:
       
   149 .BR Sender ,
       
   150 .BR From ,
       
   151 .BR Reply-To ,
       
   152 .BR Return-Path ,
       
   153 .BR Return-Receipt-To ,
       
   154 .BR Errors-To ,
       
   155 .BR Resent-Sender ,
       
   156 .BR Resent-From ,
       
   157 .BR Resent-Reply-To .
       
   158 
       
   159 If there is no
       
   160 .B From
       
   161 field,
       
   162 .B qmail-inject
       
   163 adds a new
       
   164 .B From
       
   165 field with the name of the user invoking
       
   166 .B qmail-inject.
       
   167 
       
   168 RFC 822 requires that certain sender fields contain
       
   169 only a single address, but
       
   170 .B qmail-inject
       
   171 does not enforce this restriction.
       
   172 .SH "RECIPIENT ADDRESSES"
       
   173 .B qmail-inject
       
   174 looks for recipient address lists in the following fields:
       
   175 .BR To ,
       
   176 .BR Cc ,
       
   177 .BR Bcc ,
       
   178 .BR Apparently-To ,
       
   179 .BR Resent-To ,
       
   180 .BR Resent-Cc ,
       
   181 .BR Resent-Bcc .
       
   182 
       
   183 Every message must contain at least one
       
   184 .B To
       
   185 or
       
   186 .B Cc
       
   187 or
       
   188 .BR Bcc .
       
   189 .B qmail-inject
       
   190 deletes any
       
   191 .B Bcc
       
   192 field.
       
   193 If there is no
       
   194 .B To
       
   195 or
       
   196 .B Cc
       
   197 field,
       
   198 .B qmail-inject
       
   199 adds a line
       
   200 
       
   201 .EX
       
   202      Cc: recipient list not shown: ;
       
   203 .EE
       
   204 
       
   205 This complies with RFC 822;
       
   206 it also works around some strange
       
   207 .B sendmail
       
   208 behavior, in case the message is passed through
       
   209 .B sendmail
       
   210 on another machine.
       
   211 .SH STAMPS
       
   212 Every message must contain a
       
   213 .B Date
       
   214 field, with the date in a strict format defined by RFC 822.
       
   215 If necessary
       
   216 .B qmail-inject
       
   217 creates a new
       
   218 .B Date
       
   219 field with the current date (in GMT).
       
   220 
       
   221 Every message should contain a
       
   222 .B Message-Id
       
   223 field.
       
   224 The field contents are a unique worldwide identifier for this message.
       
   225 If necessary
       
   226 .B qmail-inject
       
   227 creates a new
       
   228 .B Message-Id
       
   229 field.
       
   230 
       
   231 Another important field is
       
   232 .BR Received .
       
   233 Every time the message is sent from one system to another,
       
   234 a new
       
   235 .B Received
       
   236 field is added to the top of the message.
       
   237 .B qmail-inject
       
   238 does not create any
       
   239 .B Received
       
   240 fields.
       
   241 .SH "RESENT MESSAGES"
       
   242 A message is
       
   243 .I resent
       
   244 if it contains any of the following fields:
       
   245 .BR Resent-Sender ,
       
   246 .BR Resent-From ,
       
   247 .BR Resent-Reply-To ,
       
   248 .BR Resent-To ,
       
   249 .BR Resent-Cc ,
       
   250 .BR Resent-Bcc ,
       
   251 .BR Resent-Date ,
       
   252 .BR Resent-Message-ID .
       
   253 
       
   254 If a message is resent,
       
   255 .B qmail-inject
       
   256 changes its behavior as follows.
       
   257 
       
   258 It deletes any
       
   259 .B Resent-Bcc
       
   260 field (as well as any
       
   261 .B Bcc
       
   262 field);
       
   263 if there are no
       
   264 .B Resent-To
       
   265 or
       
   266 .B Resent-Cc
       
   267 fields,
       
   268 .B qmail-inject
       
   269 adds an appropriate
       
   270 .B Resent-Cc
       
   271 line.
       
   272 It does
       
   273 .I not
       
   274 add a
       
   275 .B Cc
       
   276 line,
       
   277 even if neither
       
   278 .B To
       
   279 nor
       
   280 .B Cc
       
   281 is present.
       
   282 
       
   283 If there is no
       
   284 .B Resent-From
       
   285 field,
       
   286 .B qmail-inject
       
   287 adds a new
       
   288 .B Resent-From
       
   289 field.
       
   290 It does
       
   291 .I not
       
   292 add a new
       
   293 .B From
       
   294 field.
       
   295 
       
   296 .B qmail-inject
       
   297 adds
       
   298 .B Resent-Date
       
   299 if one is not already present;
       
   300 same for
       
   301 .BR Resent-Message-Id .
       
   302 It does
       
   303 .I not
       
   304 add new
       
   305 .B Date
       
   306 or
       
   307 .B Message-Id
       
   308 fields.
       
   309 .SH "OTHER FEATURES"
       
   310 Addresses are separated by commas, not spaces.
       
   311 When
       
   312 .B qmail-inject
       
   313 sees an illegal space,
       
   314 it inserts a comma:
       
   315 
       
   316 .EX
       
   317      djb fred  ->  djb, fred
       
   318 .EE
       
   319 
       
   320 .B qmail-inject
       
   321 removes all
       
   322 .B Return-Path
       
   323 header fields.
       
   324 
       
   325 .B qmail-inject
       
   326 also removes any
       
   327 .B Content-Length
       
   328 fields.
       
   329 .SH "SEE ALSO"
       
   330 addresses(5),
       
   331 envelopes(5),
       
   332 qmail-inject(8)