1Mail::DKIM::DkPolicy(3)User Contributed Perl DocumentatioMnail::DKIM::DkPolicy(3)
2
3
4
6 Mail::DKIM::DkPolicy - represents a DomainKeys Sender Signing Policy
7 record
8
10 version 1.20200907
11
13 DomainKeys sender signing policies are described in
14 RFC4870(historical). It is a record published in the message sender's
15 (i.e. the person who transmitted the message) DNS that describes how
16 they sign messages.
17
19 fetch() - fetch a sender signing policy from DNS
20 my $policy = Mail::DKIM::DkPolicy->fetch(
21 Protocol => 'dns',
22 Sender => 'joe@example.org',
23 );
24
25 The following named arguments are accepted:
26
27 Protocol
28 always specify "dns"
29
30 Author
31 the "author" of the message for which policy is being checked.
32 This is the first email address in the "From" header. According to
33 RFC 2822, section 3.6.2, the "From" header lists who is responsible
34 for writing the message.
35
36 Sender
37 the "sender" of the message for which policy is being checked.
38 This is the first email address in the "Sender" header, or if there
39 is not a "Sender" header, the "From" header. According to RFC
40 2822, section 3.6.2, the "Sender" header lists who is responsible
41 for transmitting the message.
42
43 Depending on what type of policy is being checked, both the Sender and
44 Author fields may need to be specified.
45
46 If a DNS error or timeout occurs, an exception is thrown.
47
48 Otherwise, a policy object of some sort will be returned. If no policy
49 is actually published, then the "default policy" will be returned. To
50 check when this happens, use
51
52 my $is_default = $policy->is_implied_default_policy;
53
54 new() - construct a default policy object
55 my $policy = Mail::DKIM::DkPolicy->new;
56
57 parse() - gets a policy object by parsing a string
58 my $policy = Mail::DKIM::DkPolicy->parse(
59 String => 'o=~; t=y'
60 );
61
63 apply() - apply the policy to the results of a DKIM verifier
64 my $result = $policy->apply($dkim_verifier);
65
66 The caller must provide an instance of Mail::DKIM::Verifier, one which
67 has already been fed the message being verified.
68
69 Possible results are:
70
71 accept
72 The message is approved by the sender signing policy.
73
74 reject
75 The message is rejected by the sender signing policy.
76
77 neutral
78 The message is neither approved nor rejected by the sender signing
79 policy. It can be considered suspicious.
80
81 flags() - get or set the flags (t=) tag
82 A vertical-bar separated list of flags.
83
84 is_implied_default_policy() - is this policy implied?
85 my $is_implied = $policy->is_implied_default_policy;
86
87 If you fetch the policy for a particular domain, but that domain does
88 not have a policy published, then the "default policy" is in effect.
89 Use this method to detect when that happens.
90
91 location() - where the policy was fetched from
92 DomainKeys policies only have per-domain policies, so this will be the
93 domain where the policy was published.
94
95 If nothing is published for the domain, and the default policy was
96 returned instead, the location will be "undef".
97
98 note() - get or set the human readable notes (n=) tag
99 Human readable notes regarding the record. Undef if no notes specified.
100
101 policy() - get or set the outbound signing policy (o=) tag
102 my $sp = $policy->policy;
103
104 Outbound signing policy for the entity. Possible values are:
105
106 "~" The default. The domain may sign some (but not all) email.
107
108 "-" The domain signs all email.
109
110 signall() - true if policy is /-"
111 testing() - checks the testing flag
112 my $testing = $policy->testing;
113
114 If nonzero, the testing flag is set on the signing policy, and the
115 verify should not consider a message suspicious based on this policy.
116
118 • Jason Long <jason@long.name>
119
120 • Marc Bradshaw <marc@marcbradshaw.net>
121
122 • Bron Gondwana <brong@fastmailteam.com> (ARC)
123
125 Work on ensuring that this module passes the ARC test suite was
126 generously sponsored by Valimail (https://www.valimail.com/)
127
129 • Copyright (C) 2013 by Messiah College
130
131 • Copyright (C) 2010 by Jason Long
132
133 • Copyright (C) 2017 by Standcore LLC
134
135 • Copyright (C) 2020 by FastMail Pty Ltd
136
137 This library is free software; you can redistribute it and/or modify it
138 under the same terms as Perl itself, either Perl version 5.8.6 or, at
139 your option, any later version of Perl 5 you may have available.
140
141
142
143perl v5.34.0 2022-01-21 Mail::DKIM::DkPolicy(3)