NAME

Mail::DKIM::Policy - represents a DKIM sender signing policy

DESCRIPTION

A sender signing policy, according to DKIM, is a record published in the message author's DNS that describes how they sign messages.

CONSTRUCTORS

fetch() - fetch a sender signing policy from DNS

my $policy = fetch Mail::DKIM::Policy(
                 Protocol => "dns",
                 Domain => "example.org",
             );

If a DNS error or timeout occurs, an exception is thrown.

If the policy is not found, or a non-DNS error occurs, undef is returned instead of a policy.

new() - construct a default policy object

my $policy = new Mail::DKIM::Policy;

parse() - gets a policy object by parsing a string

my $policy = parse Mail::DKIM::Policy(
                 String => "o=~; t=y"
             );

METHODS

apply() - apply the policy to the results of a DKIM verifier

my $result = $policy->apply($dkim_verifier);

The caller must provide an instance of Mail::DKIM::Verifier, one which has already been fed the message being verified.

Possible results are:

accept

The message is approved by the sender signing policy.

reject

The message is rejected by the sender signing policy.

neutral

The message is neither approved nor rejected by the sender signing policy. It can be considered suspicious.

as_string() - the policy as a string

Note that the string returned by this method will not necessarily have the tags ordered the same as the text record found in DNS.

flags() - get or set the flags (t=) tag

A vertical-bar separated list of flags.

note() - get or set the human readable notes (n=) tag

Human readable notes regarding the record. Undef if no notes specified.

policy() - get or set the outbound signing policy (o=) tag

my $sp = $policy->policy;

Outbound signing policy for the entity. Possible values are:

~

The entity signs some but not all email.

-

All mail from the entity is signed; unsigned email MUST NOT be accepted, but email signed with a Verifier Acceptable Third Party Signature SHOULD be accepted.

Other values are possible as well, they just haven't been documented yet.

testing() - checks the testing flag

my $testing = $policy->testing;

If nonzero, the testing flag is set on the signing policy, and the verify should not consider a message suspicious based on this policy.

BUGS

  • If a sender signing policy is not found for a given domain, the fetch() method should search the parent domains, according to section 4 of the dkim-ssp Internet Draft.

AUTHOR

Jason Long, <jlong@messiah.edu>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Messiah College

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.