SYNOPSIS

    use Mail::Milter::Module::MailDomainDNSBL;

my $milter = new Mail::Milter::Module::MailDomainDNSBL('foo.spamlist.dom');

my $milter2 = &MailDomainDNSBL('foo.spamlist.dom'); # convenience

$milter2->set_message('Mail from %M disallowed');

DESCRIPTION

This milter module rejects any mail from a sender's domain (in the \s-1MAIL\s0 \s-1FROM\s0 part of the \s-1SMTP\s0 transaction, not in the From: header) matching a given \s-1DNS\s0 Blocking List (\s-1DNSBL\s0). It can also function as a whitelisting Chain element; see \*(C`accept_match()\*(C'.

The check used by this module is a simple \*(L"A\*(R" record lookup, via the standard \*(L"gethostbyname\*(R" lookup mechanism. This method does not require the use of Net::DNS and is thus typically very fast.

METHODS

new(\s-1DNSBL\s0)
new(\s-1DNSBL\s0, MATCHRECORD[, ...])
new(\s-1DNSBL\s0, \s-1SUBREF\s0)

Creates a MailDomainDNSBL object. \s-1DNSBL\s0 is the root host hierarchy to use for lookups. Three methods of matching can be used: If no additional arguments are provided, the match succeeds if there is any address entry present for the \s-1DNSBL\s0 lookup; the values are not examined. If one or more \s-1MATCHRECORD\s0 values are supplied, they are string representations of IPv4 addresses. If any of these match record values is the same as any address record returned by the \s-1DNSBL\s0 lookup, the match succeeds. If a \s-1SUBREF\s0 (reference to a subroutine; may be an anonymous inline \*(C`sub{}\*(C') is supplied, it is called for each of the address records returned by the \s-1DNSBL\s0 lookup. The subroutine should return 0 or undef to indicate a failed match, and nonzero to indicate a successful match. The subroutine receives two arguments: a binary-encoded four byte scalar that should be transformed as needed with \*(C`inet_ntoa()\*(C' or \*(C`unpack\*(C', and the domain name being checked by the \s-1DNSBL\s0.

accept_match(\s-1FLAG\s0)

If \s-1FLAG\s0 is 0 (the default), a matching \s-1DNSBL\s0 will cause the mail to be rejected. If \s-1FLAG\s0 is 1, a matching \s-1DNSBL\s0 will cause this module to return \s-1SMFIS_ACCEPT\s0 instead. This allows a \*(C`MailDomainDNSBL\*(C' to be used inside a \*(C`Mail::Milter::Chain\*(C' container (in accept_break(1) mode), to function as a whitelist rather than a blacklist. This method returns a reference to the object itself, allowing this method call to be chained.

ignore_tempfail(\s-1FLAG\s0)

If \s-1FLAG\s0 is 0 (the default), a \s-1DNSBL\s0 lookup which fails the underlying \s-1DNS\s0 query will cause the milter to return a temporary failure result (\s-1SMFIS_TEMPFAIL\s0). If \s-1FLAG\s0 is 1, a temporary \s-1DNS\s0 failure will be treated as if the lookup resulted in an empty record set (\s-1SMFIS_CONTINUE\s0). This method returns a reference to the object itself, allowing this method call to be chained.

set_message(\s-1MESSAGE\s0)

Sets the message used when rejecting messages. This string may contain the substring %M, which will be replaced by the matching e-mail address, or %L, which will be replaced by the name of the matching \s-1DNSBL\s0. This method returns a reference to the object itself, allowing this method call to be chained.

AUTHOR

RELATED TO Mail::Milter::Module::MailDomainDNSBL…

Mail::Milter::Object