my $from;
my @rcpts;
my $ip;
+ my $user;
foreach my $elt (@envelope) {
if ( $elt =~ /^P\s[^<]*(<[^>]*>).*$/ ) {
elsif ( $elt =~ /^R\s[^<]*(<[^>]*>).*$/ ) {
push @rcpts, $1;
}
- elsif ( $elt =~ /^S .*\[(.+)\]/ ) {
- $ip = $1;
+ elsif ( $elt =~ /^S (?:<([^>]+)>)?\s*S.*\[(.+)\]/ ) {
+ if ($1) {
+ $user = $1;
+ }
+ if ($2) {
+ $ip = $2;
+ }
}
}
$headers->{IP} = $ip;
}
+ if ($user) {
+ $headers->{User} = $user;
+ }
+
http_post(
"http://$rspamd_host/checkv2", $data,
timeout => $request_timeout,