MHonArc Resources: DATEFIELDS

[Prev: CONLEN] | [Resources][TOC] | [Next: DAYBEGIN]

# DATEFIELDS

## Syntax

Envariable

  `M2H_DATEFIELDS=`field1`:`field2`:`...`:`fieldN

Element

  `<DATEFIELDS>`
  field1`:`field2`:`...`:`fieldN
  `</DATEFIELDS>`

Command-line Option

  `-datefields` field1`:`field2`:`...`:`fieldN

## Description

DATEFIELDS specify the message header fields mhonarc will search to determine the dates of messages. Each field will be checked in the ordered specified.

The value of the DATEFIELDS is a colon separated list of message header fields to check. Since it is legal for multiple fields with the same name to appear in a message header (e.g. `Received`), indexed fields are supported. For example,

    <DateFields>
    received[1]:received[0]:date
    </DateFields>

The example says that mhonarc should check the second received field, then the first received field, and then the first date field to determine the date of a message.

Indexing starts at 0. I.e. An index of 0 denotes the first occurrence of the field, 1 denotes the second, etc. If no integer index is specified, then 0 is used.

## Default Setting

    received:date

## Resource Variables

N/A

## Examples

### Using composition date

By default. mhonarc looks at the `Received` fields of a message to determine a message's date. This tends to be more accurate as it tells when the message was actually received (it is better to trust a date/time you have control over vs what the sender has control over). However, you may want to have the date based upon the time the sender composed the message. The `Date` field usually reflects the composition date. Therefore, the following setting can be used:

    <DateFields>
    date:received
    </DateFields>

### Indexed fields

Specified indexed fields can be used if mail you archive is known to following a specific delivery path. Here is an example scenario:

1. All incoming mail is first delivered to a central POP mail server of our ISP.
2. `fetchmail` is used to download the mail from the POP server to our local SMTP server.
3. The local SMTP server delivers the mail to a local user account that is used to archive the mail.

With this scenario, we prefer to use the date stamp from the ISP server since our local system may not always be up. Each step above causes a `Received` header field to be added to the message. Since `Received` fields are listed from final delivery point to starting delivery point (i.e. each step inserts a `Received` field above existing header fields), we want to base the message date on the 3rd `Received` field (the one created by the ISP mail server). Hence, DATEFIELDS shall be set to the following:

    <DateFields>
    received[2]:received[1]:received[0]:date
    </DateFields>

We still specify fallback fields just-in-case.

## Version

2.1.1

## See Also

FROMFIELDS

[Prev: CONLEN] | [Resources][TOC] | [Next: DAYBEGIN]