Saturday, September 17, 2005

passing username to spamc through maildrop with postfix

I'm setting up a purely virtual postfix/mysql mail server, and I wanted to implement spamassassin to filter spam. Initially I had intended to use procmail, but postfix doesn't currently support procmail for virtual users, so I had to go with maildrop. All I wanted was to enable the line:

xfilter "/usr/local/bin/spamc -u USERNAME"

and have the username changed to the recipient for the mail being processed. After stumbling through some changes in master.cf and trying different maildrop variables, I found that the easiest way to get the username to the script was simply to pass ${recipient} as a parameter to maildrop in master.cf, like this:

maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient} ${recipient}

(yes, ${recipient} should be there twice.) This way, I can always pull the recipient email address directly into the maildroprc file by referencing $1. So my xfilter line became:

xfilter "/usr/local/bin/spamc -u $1"

then I just fleshed out my maildroprc script (i'd post it here but it's pretty specific to my setup, and other howtos on maildrop/postfix are available) to handle what happens if a mail is tagged as spam.

2 comments:

Rick van der Zwet said...

> xfilter "/usr/local/bin/spamc -u $1"

Was overlooking the -u flag for a few hours and banging my head against the wall why spamd did not get the right username, thanks for the headsup :-)

qishaya said...

Milan create week ended last night with donatella christian louboutin london disregard presenting the ending show of the autumn christian louboutin online frost 2003 italian collections.Donatella, the creative chief of christian boots the house her delayed brother founded, delivered a collection that was, christian louboutin uk as they say, very christian louboutin shoes.First up was the versus limit, louboutin boots the cheaper christian louboutin line. Girls stomped christian louboutin 2010 out with backcombed tresses bearing turquoise leather trousers, christian louboutin uk sale patchwork pullover and blonde fur sliced into stoles and active jackets. christian boots uk But this aggressive hell’s angels look almost seemed a caricature of the christian louboutin boots christian louboutin boots comfort. louboutin sandals Next up was gianni christian louboutin, buy christian louboutin the main collection