Hello,
i use a PERL script with Mail::SPF to check the SPF-records from received emails. The PERL module seems to have problems with the DNS. After 1-2 min. i get the error: unresolvable name: nameserver at /usr/share/perl5/Mail/SPF/Server.pm line 225

The network and resolf.conf settings from the debian 8 seams to be ok. I have no problems to resolve the IP from google.com or other names. I tried the solution from https://archive.kiza.eu/journal/entry/720 and added a line with localhost in resolf.con, unfortunately this did not help.

This is my code:
#! /usr/bin/perl use strict; use Socket; use warnings; use Email::Simple; use DBI; use File::Copy; use Date::Parse; use DateTime; use Path::Tiny qw(path); use Mail::DKIM::Verifier; use Mail::SPF; use Encode; use utf8; open (MESSAGE, "< $ARGV[0]") || die "Couldn't open email $ARGV[0]\n"; undef $/; my $raw_email = <>; close MESSAGE; my $mail = Email::Simple->new($raw_email); my $return_path = $mail->header("Return-Path"); my $from_header = $mail->header("From"); my $ip = $mail->header("X-IP"); my $spf = &spf_check($ip,$return_path); sub spf_check { my ($ip, $domain); ($ip, $domain) = @_; $domain =~ s/<|>//g; $domain =~ s/^.*@//g; my $spf_server = Mail::SPF::Server->new(); my $spf_request = Mail::SPF::Request->new ( versions => [1,2], scope => 'mfrom', identity => $domain, ip_address => $ip ); my $return = $spf_server->process($spf_request); }
Is the error in my PERL source code or in the system settings of the linux OS?

kind regards
nifu

In reply to DNS problems with Mail::SPF by nifu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.