[Mimedefang] SPF help needed

Super-Dome talha at worldcall.net.pk
Sat Oct 1 10:57:55 EDT 2005


Dear ALL

I have checked  that SPF record is working fine .  i am putting the following 
code above filter_begin .which is also mentioned in Wiki 

died prematurely -- check your filter rules

Thanks and Regards 

SD 



#  %PROCEDURE: spf_query

sub spf_query ($$$$) {

      my ($ip, $sender, $helo, $guess) = @_;

      # The guess parameter needs to be set to either 0 or 1.
      if ($guess != 1) {
              $guess = 0;
      }

      # Check this sender against any SPF or Caller-ID records
      # that might be available.
      my $query = new Mail::SPF::Query ( ip           => $ip,
                                         sender       => $sender,
                                         helo         => $helo,
                                         guess        => $guess,
                                         callerid     => {
                                              "*."    => {
                                              check   => 1 } }
      );

      my ($result, $smtp_comment, $header_comment, $spf_record) =
              $query->result();

      return ($result, $smtp_comment, $header_comment, $spf_record);
}

sub filter_sender {

# Query for SPF information with guess mode off
      my ($result, $smtp_comment, $header_comment, $spf_record) =
              spf_query ($ip, $sender, $helo, 0);

      # If SPF says this sender is not coming from an authorized MTA,
      # then reject it.
      if ($result eq "fail") {
         md_syslog ('info', "Received-SPF: $result ($header_comment) " .
              "$spf_record, Helo=$helo");
         return('REJECT', "Access Denied (SPF) [$smtp_comment], " .
              "Relay=$hostname [$ip], Helo=$helo");
      } else {
              return ('CONTINUE', "ok");
      }
      }





-- WorldCALL Webmail




More information about the MIMEDefang mailing list