Mail::STS::Policy - class to parse and generate RFC8461 policies
version 0.01
# generate a policy my $policy = Mail::STS::Policy->new( mode => 'enforce', max_age => 604800, mx => [ 'mail.example.com' ], ); # setters $policy->mode('testing'); $policy->add_mx('mail.example.com'); print $policy->as_string; # parse existing policy my $policy = Mail::STS::Policy->new_from_string($string); # access values $policy->mode; # 'enforce' $policy->mx; # [ 'mail.example.com' ] # check if a host is in there $policy->match_mx('mail.blablub.de') or die;
Currently always version 'STSv1'.
Get/set mode of policy.
Get/set max_age for policy caching.
Array reference to array of mx hosts.
Constructor for creating a new policy object from a policy string.
Internally creates objects by calling new() and execute parse() on it.
Parses values from $string to values in the object overwriting and clearing all existing values.
Will die() on parsing error.
Returns a hash reference containing policy data.
$policy->as_hash # { # 'version' => 'STSv1', # 'mode' => 'enforce', # 'max_age' => 3600, # 'mx' => [ 'mx.example.com', ... ], # }
Outputs the object as a RFC8461 policy document.
Returns if the policy matches $host.
$policy->match_mx('mail.example.com') or die;
Markus Benning <ich@markusbenning.de>
This software is copyright (c) 2018 by Markus Benning <ich@markusbenning.de>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mail::STS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::STS
CPAN shell
perl -MCPAN -e shell install Mail::STS
For more information on module installation, please visit the detailed CPAN module installation guide.