The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mail::SPF::Publish - Assist in the creation of DNS records for the SPF standard.

SYNOPSIS

  use Mail::SPF::Publish
 
  my $spf = Mail::SPF::Publish->new( ttl => 86400 );

    # Basic form
  $spf->mailserver( "mail_one", "mail1.example.com", [ "10.0.0.1" ] );

    # Multi-homed mail server
  $spf->mailserver( "mail_two", "mail2.example.com", [ "10.0.0.2", "192.168.0.1" ] );

    # Multi-homed mail server with CIDR style notation
  $spf->mailserver( "mail_three", "mail3.example.com", [ "10.0.0.8/30", "192.168.8.0/29" ] );

  $spf->domainservers( "example.com", [ "mail_one", "mail_two", "mail_three" ], default => 'softdeny');

  $spf->domainincludes( "myvanity.com", [ "myisp.com", "myschool.edu" ], ttl => 86400 );

  print $spf->output( format => 'bind4' );

DESCRIPTION

This module and its associated sample code are intended to be used to generate DNS zone files for SPF under tinydns and bind4-9, including any explicit wildcard recursion if necessary. Most people will want to use the supplied scripts for automatic generation of a zone, 'autospf' and 'spf2zone'.

USAGE

new

Usage
  my $spf = Mail::SPF::Publish->new();
Purpose

Creates a new SPF publishing module

Returns

The object it just created.

Arguments
explicit_wildcards

Sets whether explicit wildcards are to be generated (Default: 1)

format

Sets the type of output you want, currently only two possible values: 'bind4' and 'tinydns'. (Default: 'bind4' )

ttl

Sets the ttl for all entires in the generated DNS heirarchy. (Default: 86400)

default

Sets the default response for domains (but not on individual machines). You may set 'deny', 'softdeny', or 'accept'. (Default: 'deny') Please don't set 'accept'.

mailserver

Usage
  $spf->mailserver( alias, hostname, addresslist, options );
Purpose

Defines a mail server alias, and creates the SPF records for HELO lookups.

Arguments
alias

string alias for this entry

hostname

fully qualified domain name this mail server, and hostname name supplied at HELO phase.

addresslist

arrayref of network address of this mail server (currently only ipv4 addresses are supported, CIDR notation is optional.)

domainservers

Usage
  $spf->domainservers( domain, aliaslist, options )
Purpose

Create SPF records to indicate that servers identified by aliaslist are allowed to send from domain.

Arguments
domain

Domain name to which you are adding mail servers to for SPF record generation.

aliaslist

Arrayref of server aliases, defined with the mailserver() function.

options

Option list to override default options, and those specified in new().

domainincludes

Usage
  $spf->domainincludes( my_domain, other_domain_list, options )
Purpose

Creates 'SPFinclude=other_domain' TXT records for my_domain; this allows my_domain to designate mailservers belonging to other_domain.

Arguments
my_domain

Domain under our control.

other_domain_list

Arrayref of domains which SPFinclude records will point to. These domains are not under our control, but we want to designate their servers.

Notes

If the other_domains are under your control, use domainservers() to create full-fledged entries for them directly; this improves query time and saves traffic.

output

Usage
  print $spf->output( options );

or

  my $output = $spf->output( options );
Purpose

Compiles domain information collected by all the previous method calls, and produces an output suitable for use in the specified (or default, if you didn't specify) name server.

Returns

A multi-line string containing the output.

Arguments

This function will take an explicit_wildcards and format option as documented under the new() function. The supplied values will be used to override the default provided in the new() function for the current call only.

BUGS

Entering anything besides IPv4 addresses into address lists may throw an error, or may just mangle the output.

Undoubtably others.

SUPPORT

Send a message to subscribe-spf-discuss@v2.listbox.com.

See also http://spf.pobox.com/

AUTHOR

Jonathan Steinert hachi@cpan.org

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

http://spf.pobox.com/ Mail::SPF::Query