spamassassin plugin sets $username to first recipient in list when
spamd_user config option is set to 'vpopmail'. This allows per-user SA
prefs to function.
From: Matt Simerson <msimer...@perl.org>
---
plugins/spamassassin | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/plugins/spamassassin b/plugins/spamassassin
index 51177c5..fdb0b5c 100644
--- a/plugins/spamassassin
+++ b/plugins/spamassassin
@@ -155,14 +155,16 @@ sub hook_data_post { # check_spam
$transaction->body_resetpos;
my $username = $self->{_args}->{spamd_user} || getpwuid($>);
+ if ($username eq 'vpopmail') {
+ my ($recip) = $transaction->recipients();
+ chomp $recip;
+ $recip =~ s/[<>]//g;
+ $username = $recip;
+ }
print SPAMD "SYMBOLS SPAMC/1.3" . CRLF;
- print SPAMD "User: $username" . CRLF;
-
- # Content-Length:
- print SPAMD CRLF;
-
- # or CHECK or REPORT or SYMBOLS
+ print SPAMD "User: $username" . CRLF; # Content-Length:
+ print SPAMD CRLF; # or CHECK or REPORT or
SYMBOLS
print SPAMD "X-Envelope-From: ", $transaction->sender->format, CRLF
or $self->log(LOGWARN, "Could not print to spamd: $!");
--
1.7.0.6