What's the best way, taking advantage of existing SA code, to get the last untrusted relay from an email (for use with black lists and white lists), without going through scoring?
This is the one option I've gotten to work: http://www.chaosreigns.com/iprep/dl/received.pl It unfolds the Received headers with new code (didn't seem worth loading another non-base perl module), and then feeds them one at a time to Mail::SpamAssassin::Message::Metadata::parse_received_line(). And using more new code to check for trusted_relays. I tried to replicate the trust inferring. It seems like there should be a way to load an email into a $msg object: my $msg = Mail::SpamAssassin::Message->new({'message' => $rawmessage, 'parse_now' => 1}); ..And then get it to give me $self->{relays_untrusted_str}. But it looks like that might only be available from a Mail::SpamAssassin::PerMsgStatus object which is only returned by Mail::SpamAssassin::check()? Working on a new, hopefully more automated, whitelist / reputation thing. parse_received_line() is 1008 lines of (thankfully heavily commented) nuts. It's embarrassing that Received headers are so nonstandard that it takes that much code to parse them. -- "It's never too late to panic." http://www.ChaosReigns.com
