When building statistics from mail servers, messages which where
processed by Sender Rewriting Scheme (SRS) are mis-classified as
internal mail while they are external, and appear to come from a huge
number of different addresses which in fact correspond to the same
actual sender.
Add a rewriting function that detects such addresses and extract the
relevant information from it.
return $_;
}
+sub UnwrapSRS { $_=shift||'';
+ s/^SRS1=.*=([^=]+)=([^@]+)@.*$/\2@\1/g;
+ s/^SRS0=[^=]+=[^=]+=([^=]+)=([^@]+)@.*$/\2@\1/g;
+ return $_;
+}
+
sub CleanEmail { $_=shift||'';
s/[#<|>\[\]]//g; # Remove unwanted characters first
- return $_;
+ return &UnwrapSRS($_);
}
# Clean host addresses