# Evolution + SpamAssassin = less spam in your mailbox

## pilla

I've seen some tutorials about how to setup SpamAssassin in the client using Kmail, but not with Evolution. This method does not need server support. People with SpamAssassin installed in their servers may use the X-Spam-Flag to filter email, but those who do not have SpamAssassin installed in their mail servers and don't want to setup all the fetchmail/procmail stuff, can use the following procedure (considering that Evolution is already installed):

1. emerge Mail-SpamAssassin 

2. In Evolution,  

    2.1 create a folder called SPAM

    2.2  go to Tools, Filters, incoming filter rules, add a new Rule. 

    2.3 name it with something meaningfull (like SPAM  :Cool: )

    2.4 In the If  box, 

        2.4.1 select Pipe Message to Shell Command

        2.4.2 Enter the command  (I use also the --local to reduce bandwidth, see man spamassassin for more info)

```

spamassassin -e

```

        2.4.3 select returns greater than  and 0 (zero). 

      The -e option means that it will return a value different of zero if it finds a SPAM.

    2.5 In the Then box,

         2.5.1 Select  Move to Folder

         2.5.2 Select  "SPAM" in "Local Folders"

And that's all. For more effective use of SpamAssassin, please read the man. You can add addresses to blacklist, whitelist, etc. using the command line. There is also a daemon that can be used, but I haven't tried that. For the last two days, it has got 9 SPAMs, missed 2 and had zero false SPAMs.

----------

## craftyc

 *Bloody Bastard wrote:*   

> I've seen some tutorials about how to setup SpamAssassin in the client using Kmail, but not with Evolution. This method does not need server support. People with SpamAssassin installed in their servers may use the X-Spam-Flag to filter email, but those who do not have SpamAssassin installed in their mail servers and don't want to setup all the fetchmail/procmail stuff, can use the following procedure (considering that Evolution is already installed):
> 
> 1. emerge Mail-SpamAssassin 
> 
> 2. In Evolution,  
> ...

 

hmm.. I don't have "pipe message to shell command". Did I compile Evolution wrong?

----------

## pilla

I am running 1.2.0....

----------

## craftyc

 *Bloody Bastard wrote:*   

> I am running 1.2.0....

 

Could be the problem. I'm using 1.0.8. I'll try again once I've emerged the newer version.

----------

## craftyc

Thanks for the tip. This works quite well.

----------

## DesertFox

Thanks for the info.  Once I upgraded to 1.2.0, it worked like a charm.  I did notice that the ebuild for Mail-SpamAssassin-2.43-r2.ebuild is broken, and I had to install the masked Mail-SpamAssassin-2.43-r3.ebuild to get Spam Assassin to work, but once I did that, it worked great.

----------

## absinthe

Now, if only SpamAssassin was faster...  I'm not sure which takes more time... me sorting through my spam, or SA's cpu time doing it for me.

----------

## pilla

There is an option for leaving a spamd running on the background and using a spamc to access it. It may help your performance problem, which I haven't experiencied.

 *absinthe wrote:*   

> Now, if only SpamAssassin was faster...  I'm not sure which takes more time... me sorting through my spam, or SA's cpu time doing it for me.

 

----------

## absinthe

 *Bloody Bastard wrote:*   

> There is an option for leaving a spamd running on the background and using a spamc to access it. It may help your performance problem, which I haven't experiencied.
> 
>  *absinthe wrote:*   Now, if only SpamAssassin was faster...  I'm not sure which takes more time... me sorting through my spam, or SA's cpu time doing it for me. 

 

Yeah, that's what I've been using... spamd.

----------

## pilla

You could try spamassassin instead of spamc. I don't see major performance slowdowns, and I am running it in a laptop P3 1.2 GHz (the disk is 4x slower than a desktop disk)

 *absinthe wrote:*   

>  *Bloody Bastard wrote:*   There is an option for leaving a spamd running on the background and using a spamc to access it. It may help your performance problem, which I haven't experiencied.
> 
>  *absinthe wrote:*   Now, if only SpamAssassin was faster...  I'm not sure which takes more time... me sorting through my spam, or SA's cpu time doing it for me.  
> 
> Yeah, that's what I've been using... spamd.

 

----------

## absinthe

 *Bloody Bastard wrote:*   

> You could try spamassassin instead of spamc. I don't see major performance slowdowns, and I am running it in a laptop P3 1.2 GHz (the disk is 4x slower than a desktop disk)
> 
> 

 

I tried it both ways, the former is slower than the latter.   I think the parting shot is that you might not get as much mail as I do on a daily basis.  I normally get about 600-650 emails a day... across a few accounts.   It sounds excessive but most of it is necessary.  Much of that is spam... which is why I continue to run spamc even though it slows things down quite a bit.

Before my email even gets to spamc, (depending on the account) it's had to pass at least one external spam filters (provided by the ISP or whatever) -- sometimes two or three ... so the mere fact that spam still constitutes a double-digit percentage of my inbound mail by the time it hits spamc is saying something.

----------

## Matje

I was having problems with my mails and finally found that it was spamassassin that was causing them. Mails would keep coming in again and again. First I thought it was my ISP, but then it started to happen with other accounts too, so I started looking. I deleted all my filters et voila, no more double mails. I added them again and started deleting one by one, and yes it was spamassassin. I guess it was taking spamassassin that long to process that the connection timed out and evolution couldn't send the DELE command to the POP. I added the --local option and now it runs much faster. Could it be that it can't find my proxy settings or something like that?

----------

## pilla

SpamAssassin tries to access some sites to gather and distribute information about your spam mail. I use --local to reduce bandwidth (see my first post, 2.4.2).

----------

## Matje

I know that, but I thought it might be so slow because it can't find my proxy. And surfing without it is impossible  :Smile: 

----------

## bier

I tried this too but it doesn't work for me ..  :Sad: 

When I do a "spamassassin -e < mail" with "mail" being a saved mail it returns a whole report on found tags and a spam-score. That seems all allright to me, except it's more then just a number that evolution might be expecting.

I use evolution 1.2.0 and spamassassin 2.43. My filter in evolution is the same    as the example. What can be the problem?

----------

## cbrese

I just set this up and it works great if I leave Evolution running, but if I shut Evolution down and then open it up a few hours latter it really seams to choak on 30 or 40 emails.

I've tried both spamassassin -e and spamc -c.  I think I will try to setup spamassassin directly in postfix and then just filter on the X-Spam-Flag header.

----------

## cbrese

Ignore my last comment.  I  just tried the --local option and now it is much faster.  I guess there is a long timeout for the DNS checks.

----------

## Reformist

Yes, my mail checking is also much faster with --local on (I get about 150 a day). I have a nice connection, so I think it may have something to do with long DNS timers or something, as suggested in one of the above replies. That's a real shame, because I am all for contributing to a spam database, because I hate this crap.

Heheh I get about 20 letters a day from some prince, or king's window or whateverr in African offering to split some 20$ million account with me if I will only lend my bank account info. Must be a lot of political turnover over there ;-) Some of the spammers are absolute morons; of course a program like this would never work if everyone else is doing it. I think computer noobs buy packages off tv or something, one of those "work from home" schemes that turns their computer into a spam center.

----------

## nouse66

i got spamassassin and razor installed yesterday and they seemed to work fine.

i read this post and decided to switch to using spamd +spamc instead of calling the full spamassassin script from evolution.

since i switched there have been no additions to my razor log file which previously logged every piece of spam i got.

is there something i need to do to re-enable razor or check to see if it's doing anything?

thanks,

aaron

----------

## nouse66

ok, well i did some more research and found the answer on the spamassassin mailing list archive.

if anyone is interested ...

all you do is edit your /etc/init.d/spamd adding the -H option to the /usr/bin/spamd in the start function.

i ended up with this:

start() {

        ebegin "Starting spamd"

        start-stop-daemon --start --quiet \

                --exec /usr/bin/spamd -- -d -H -r /var/run/spamd.pid \

                        ${SPAMD_OPTS}

        eend $? "Failed to start spamd"

}

i guess that ensures that your home directory path will make it's away to the razor script.

i'm not sure if razor was working or not before i changed that but now my log file is showing activity so it looks like razor is doing it's job.

----------

## pmatos

Won't this work when using SMTP? Why? I'm using SMTP and I tried it but my spam still arrives from server in to my inbox.  :Sad: 

Any ideas?

Best regards,

Paulo J. Matos

----------

## charlieg

This is handy but it would be nice if there were a way to 'train' spamassassin at the same time...

Perhaps an entry in the context menu or a flag like with Mozilla's mail client.

----------

## Reformist

You can train spamassassin at the same time.

Refer to this post regarding sa-learn usage in general,

http://lists.ximian.com/archives/public/evolution/2003-October/033588.html

When something is determined to be spam, instead of just moving it to a spam folder or deleting it, first run it through"sa-learn --spam" and then move it or delete it.

Works great for me, although I usually just accumulate a lot of spam and then run sa-learn on the entire spam folder.

----------

## charlieg

 *Reformist wrote:*   

> You can train spamassassin at the same time.
> 
> Refer to this post regarding sa-learn usage in general,
> 
> http://lists.ximian.com/archives/public/evolution/2003-October/033588.html

 

Good link, but it's still a little contorted...

There should, and may, be a way to add a context menu entry in saying 'This is spam' or 'This is not spam' so you can can simply click away rather than messing around moving mail between folders, running cron jobs, then deleting or moving the mail back at a later date.

----------

## mallchin

I using fetchmail, gotmail, courier, amavisd-new, clamav & spamassassin; took some time to configure but it works great  :Very Happy: 

Firstly courier is proper mail suite including POP3 and SMTP servers, I connect to those to send & recieve mail using evolution. I have courier installed on a spare box, and use fetchmail & gotmail to check my ISP's POP3, and HoTMaiL. They are downloaded and delivered locally via SMTP.

Incoming SMTP traffic is filtered via amavisd-new for spam and virii, the advantage being spamassassin's vigourous scanning has already taken place when I pickup mail via POP3 with evolution. Infected or unwanted mail is forwarded to quarantine mail accounts. Many more options are available to warn the sender, recipient, admin or other about the infection.

----------

## AresTheImpaler

 *Matje wrote:*   

> I was having problems with my mails and finally found that it was spamassassin that was causing them. Mails would keep coming in again and again. First I thought it was my ISP, but then it started to happen with other accounts too, so I started looking. I deleted all my filters et voila, no more double mails. I added them again and started deleting one by one, and yes it was spamassassin. I guess it was taking spamassassin that long to process that the connection timed out and evolution couldn't send the DELE command to the POP. I added the --local option and now it runs much faster. Could it be that it can't find my proxy settings or something like that?

 

I had the same problem.. to stop doing that, when you create the filter to run spamassasin.. under 'then' box add a new action, and select 'Stop Processing'. Now I dont get any double mails! :D

----------

## helmers

Just wanted to thank you for this great tip!

A quick solution to my spam problem, it was really piling up.   :Wink: 

----------

## GaryMercer

Thanks for the Howto.

Just set this up on Evolution 1.5.7 and it works a treat with Spamassassin 2.63.

Once again, Thanks !

----------

## charlieg

Am I the only one suffering because of the shocking performance of spamd?  It's an absolute CPU hog.

----------

## Byrne

True, but in my opinion Evolution 2.0 is in all slower/sluggier than Evolution 1.4.6. If I switch between folders, it may take up to 3 seconds before it actually makes the switch. Using a Athlon XP 1600 with 512 megs of RAM.

----------

