ot, spamassassin question

Gregory Nowak greg at romuald.net.eu.org
Mon Jan 18 17:16:22 EST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all.

As you may recall, a while back, I posted a ssl cert question, in
which I described that I'm setting up e-mail for my mom on my system,
and I needed some ssl opinions. Thanks again to those who responded.

Now, however, I have a new question, this time regarding
spamassassin. Let me provide some background for my question. My mom's
e-mail is piped through spamassassin, and then piped through
maildrop. If the message is not spam, it is delivered to maildir. If
"X-Spam-Flag" or "X-Spam-Status" are YES, the message is delivered to
maildir/.Spam. When my mom reads her mail, anything in the inbox that
is spam, she moves to Spam (which puts it into maildir/.Spam/cur), and
anything in the Spam folder which is ham, she moves to her inbox
(which puts it into maildir/cur). Every 24 hours, I run a script which
I lifted from the web, and modified for my needs, which runs sa-learn
on maildir/cur, and maildir/.Spam/cur, and tags them accordingly.

Ok, here's my problem/question. She's complaining that she keeps
placing messages from certain senders into the Spam folder, but new
messages from those senders still get marked as ham. So, what I need
is a sender blacklist approach, where if a message from sender x is
learned as spam, every other message from sender x will always be
marked as spam in the future, and I need this to be done in a way
transparent to the user (I.E. my mom keeps sorting inbox, and Spam
like she has up until now). I had a look at the spamass docs, but
there's no facility that does exactly what I need as far as I can
tell. The closest thing I found are lines like
blacklist_from someone at example.com
which one can place in the prefs file. So, the idea I have is to
include a file called blacklist from the prefs file. The blacklist
file would have lines of the form I just described. The script I run
every day to tag messages (or a different script), would grep through
all files in maildir/.Spam/cur/, and extract the from address,
appending a line like "blacklist_from from at addr.ess" to the blacklist
file.

Here is where my problems are. The first problem is that echoing
anything to a file over writes everything in that file. So, what I'm
thinking of is something like:

mv blacklist blacklist.old
echo -e "blacklist_from " >blacklist.tmp
echo output_from_grep>blacklist.tmp1
cat blacklist.tmp blacklist.tmp1 blacklist.old >blacklist
rm blacklist.tmp*
rm blacklist.old

This should work in theory, but it's cumbersome, and I was wondering if
someone had a better approach.

My second problem is with grep. If I invoke grep as:

grep -i "from" maildir/.Spam/cur/* |grep -o "@" 

I get a bunch of @ signs, but I want the e-mail address from the From:
line of each message. I suspect this could be done with a regexp, but
regexps aren't one of my strengths. If someone could please also
explain how I'd invoke grep to get the desired output, I'd really
appreciate it.

If you want to see the script I run every day to tag ham and spam, so
as to get an idea of how I could integrate into it the blacklisting
functionality, let me know, and I'll send it to you, so as not to
clutter the list. Thanks very much in advance for any
help/suggestions.

Greg


- -- 
web site: http://www.romuald.net.eu.org
gpg public key: http://www.romuald.net.eu.org/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)

- --
Free domains: http://www.eu.org/ or mail dns-manager at EU.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAktU3bYACgkQ7s9z/XlyUyDtvACguj2D/XUevj9bcDIPej5RjtU9
LLwAoJ/LamItbImDiRNLbR2C8AavbRHJ
=sjGu
-----END PGP SIGNATURE-----



More information about the Speakup mailing list