SYNOPSIS

    use Courier::Filter::Module::FakeDate;

    my $module = Courier::Filter::Module::Header->new(
        forward_tolerance   => {
            # years, months, weeks, days, hours, minutes, seconds
            hours       => 2
        },
        backward_tolerance  => {
            # years, months, weeks, days, hours, minutes, seconds
            days        => 5
        },

        ignore_unparseable  => 0,

        logger      => $logger,
        inverse     => 0,
        trusting    => 0,
        testing     => 0,
        debugging   => 0
    );

    my $filter = Courier::Filter->new(
        ...
        modules     => [ $module ],
        ...
    );

DESCRIPTION

This class is a filter module class for use with Courier::Filter. It matches a message if it has a \*(C`Date\*(C' header field that lies too far in the future or the past, relative to the local system's time. If the message has a \*(C`Resent-Date\*(C' header field (see \s-1RFC\s0 2822, 3.6.6), that one is examined instead, because the message could simply be an old one that has recently been re-sent, which is perfectly legitimate behavior.

In the case of a match, the response tells the sender that their \*(C`Date\*(C' header is implausible and that they should check their clock.

Note: Times in different time zones are compared correctly.

Note: When using this filter module, it is essential that the local system's own clock is set correctly, or there will be an increased risk of legitimate messages getting rejected.

Constructor

The following constructor is provided:

new(%options): returns Courier::Filter::Module::FakeDate

Creates a new FakeDate filter module. %options is a list of key/value pairs representing any of the following options:

forward_tolerance
backward_tolerance

The maximum durations by which a message's \*(C`Date\*(C' or \*(C`Resent-Date\*(C' header may diverge into the future and the past, respectively, from the local system's time. Each duration must be specified as a hash-ref containing one or more time units and their respective quantity/ies, just as specified by DateTime::Duration. \*(C`forward_tolerance\*(C' defaults to 2 hours. \*(C`backward_tolerance\*(C' defaults to 5 days to account for transmission delays. For example: forward_tolerance => { hours => 4 }, backward_tolerance => { days => 1, hours => 12 }

ignore_unparseable

A boolean value controlling whether messages whose \*(C`Date\*(C' or \*(C`Resent-Date\*(C' header does not loosely conform to RFCs 822 or 2822 should be ignored (true) or matched (false). Defaults to false.

All options of the Courier::Filter::Module constructor are also supported. Please see \*(L"new\*(R" in Courier::Filter::Module for their descriptions.

Instance methods

See \*(L"Instance methods\*(R" in Courier::Filter::Module for a description of the provided instance methods.

RELATED TO Courier::Filter::Module::FakeDate…

Courier::Filter::Module, Courier::Filter::Overview.

For \s-1AVAILABILITY\s0, \s-1SUPPORT\s0, and \s-1LICENSE\s0 information, see Courier::Filter::Overview.

AUTHOR

Julian Mehnle <[email protected]>