| 1 | # | ||
| 2 | # Mail::SPF | ||
| 3 | # An object-oriented Perl implementation of Sender Policy Framework. | ||
| 4 | # <http://search.cpan.org/dist/Mail-SPF> | ||
| 5 | # | ||
| 6 | # (C) 2005-2012 Julian Mehnle <julian@mehnle.net> | ||
| 7 | # 2005 Shevek <cpan@anarres.org> | ||
| 8 | # $Id: SPF.pm 63 2013-07-22 03:52:21Z julian $ | ||
| 9 | # | ||
| 10 | ############################################################################## | ||
| 11 | |||
| 12 | package Mail::SPF; | ||
| 13 | |||
| 14 | =head1 NAME | ||
| 15 | |||
| 16 | Mail::SPF - An object-oriented implementation of Sender Policy Framework | ||
| 17 | |||
| 18 | =head1 VERSION | ||
| 19 | |||
| 20 | version 3.20261105 | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | 1 | our $VERSION = '3.20261105'; # VERSION | |
| 25 | |||
| 26 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 27 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 28 | |||
| 29 | 1 | ▶ | use Mail::SPF::Server; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 1 | ▶ | use Mail::SPF::Request; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | |||
| 32 | 1 | ▶ | use constant TRUE => (0 == 0); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 33 | 1 | ▶ | use constant FALSE => not TRUE; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | |||
| 35 | =head1 SYNOPSIS | ||
| 36 | |||
| 37 | use Mail::SPF; | ||
| 38 | |||
| 39 | my $spf_server = Mail::SPF::Server->new(); | ||
| 40 | |||
| 41 | my $request = Mail::SPF::Request->new( | ||
| 42 | versions => [1, 2], # optional | ||
| 43 | scope => 'mfrom', # or 'helo', 'pra' | ||
| 44 | identity => 'fred@example.com', | ||
| 45 | ip_address => '192.168.0.1', | ||
| 46 | helo_identity => 'mta.example.com' # optional, | ||
| 47 | # for %{h} macro expansion | ||
| 48 | ); | ||
| 49 | |||
| 50 | my $result = $spf_server->process($request); | ||
| 51 | |||
| 52 | print("$result\n"); | ||
| 53 | my $result_code = $result->code; # 'pass', 'fail', etc. | ||
| 54 | my $local_exp = $result->local_explanation; | ||
| 55 | my $authority_exp = $result->authority_explanation | ||
| 56 | if $result->is_code('fail'); | ||
| 57 | my $spf_header = $result->received_spf_header; | ||
| 58 | |||
| 59 | =head1 DESCRIPTION | ||
| 60 | |||
| 61 | B<Mail::SPF> is an object-oriented implementation of Sender Policy Framework | ||
| 62 | (SPF). See L<https://tools.ietf.org/html/rfc7208> for more information about | ||
| 63 | SPF. | ||
| 64 | |||
| 65 | This class collection aims to fully conform to the SPF specification (RFC | ||
| 66 | 4408) so as to serve both as a production quality SPF implementation and as a | ||
| 67 | reference for other developers of SPF implementations. | ||
| 68 | |||
| 69 | =head1 SEE ALSO | ||
| 70 | |||
| 71 | L<Mail::SPF::Server>, L<Mail::SPF::Request>, L<Mail::SPF::Result> | ||
| 72 | |||
| 73 | For availability, support, and license information, see the README file | ||
| 74 | included with Mail::SPF. | ||
| 75 | |||
| 76 | =head1 REFERENCES | ||
| 77 | |||
| 78 | =over | ||
| 79 | |||
| 80 | =item The SPF project | ||
| 81 | |||
| 82 | L<http://www.open-spf.org/> | ||
| 83 | |||
| 84 | =item The SPFv1 specification (RFC 7208) | ||
| 85 | |||
| 86 | L<http://www.open-spf.org/Specifications>, L<https://tools.ietf.org/html/rfc7208> | ||
| 87 | |||
| 88 | =back | ||
| 89 | |||
| 90 | =head1 AUTHORS | ||
| 91 | |||
| 92 | Julian Mehnle <julian@mehnle.net>, Shevek <cpan@anarres.org> | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | 1 | TRUE; | |