John Rudd writes: > Is there an SA function that will just return an array of Relays that > fit a given one of these criteria? Such as: > > @relays = get_relays(options); > > where options is a comma delimited string of words like: > Trusted - include a given relay if it is trusted > Untrusted - include a relay if it is untrusted > External - include a relay if it is external > Internal - include a relay if it is internal > LastExternal - do NOT include the relay if it is NOT the > most recent external relay > NotFirstHop - do NOT include the relay if there are multiple > relays and this one was the least recent relay > > and the returned relay array meets the specified criteria, and contains > the same data about the relays that are in the pseudo-headers? > > An SA function, particularly a PerMsgStatus method, that did something > like this would be VERY useful.
well, it's not a method -- nor is it well-documented -- but it's available. e.g. lib/Mail/SpamAssassin/Plugin/DCC.pm: my $client = $permsgstatus->{relays_external}->[0]->{ip}; if ($self->{dccifd_available}) { my $clientname = $permsgstatus->{relays_external}->[0]->{rdns}; my $helo = $permsgstatus->{relays_external}->[0]->{helo} || ""; if ($client) { if ($clientname) { $client = $client . "\r" . $clientname; } } else { $client = "0.0.0.0"; } return $self->dccifd_lookup($permsgstatus, $full, $client, $clientname, $helo); There are similar arrays under relays_trusted, relays_untrusted, relays_internal as well. Each contains {ip}, {helo}, {rdns} and the other pieces of Relays metadata. --j.