procmail
[Top] [All Lists]

Re: Moving large messages to spam folder

2017-02-16 13:51:03
On Wed, 2017-02-15 at 20:53 -0700, @lbutlr wrote:
On 2017-02-12 (19:19 MST), Chris <cpollock(_at_)embarqmail(_dot_)com> wrote:


Anything bigger than 100k has the subject appended as below. Lately
I've been getting messages from yahoo accounts that run about 630k
give
or take that I know are spam and I'd like to have them moved with
procmail to my spam folder automatically. I found the 2nd formail
recipe below by doing some googling and put it into my .procmailrc.
Instead of using the sender IP I've been putting the CIDR into the
badips file - 98.136.192.0/18 for example. I don't want to filter
out
all of yahoo because I have a few yahoo mailing lists I'm on. Does
this
make sense or is there a much easier way to do this?

:0 fh w
* > 100000
* ^Subject:\/.*

formail -I "Subject: {* -BIG- *} $MATCH"

:0
* ? formail -x"From:" -x"Sender:" \
    -x"Reply-To:" -x"Return-Path:" \
    | egrep -is -f /home/chris/badips
$JUNKMAIL

I would do the following:

:0 fh w
* > 100000
{
  :0fw # Need to wait for filter to complete
  * ^Subject:\/.*
  | formail -I "Subject: {* -BIG- *} $MATCH"

  :0
  * ? formail -x"From:" -x"Sender:" \
    -x"Reply-To:" -x"Return-Path:" \
    | egrep -is -f /home/chris/badips
    $JUNKMAIL
}

(This assumes the formail works as you expect)

This way the only messages that are checked for badips are ones that
are larger than 100,000 bytes.

Personally, Yahoo is dead to me now. All messages are rejected with a
message about pathological lack of security. It forced two of my
family members to stop using Yahoo as they could no longer email the
rest of the family that is on my mail server. :)

I wouldn’t trust any email from yahoo, but that’s just me.

Actually I thought of a better way:

:0 fh w
* > 625000
* ^From:.*@yahoo.com
$JUNKMAIL

and as I leave any yahoo lists I'm on I can remove the size modifier
from the recipe and just leave it as from yahoo.

-- 
Chris
KeyID 0xE372A7DA98E6705C
31.11972; -97.90167 (Elev. 1092 ft)
13:46:09 up 13 days, 5:44, 2 users, load average: 0.88, 1.51, 1.29
Description:    Ubuntu 16.04.2 LTS, kernel 4.4.0-62-generic

Attachment: signature.asc
Description: This is a digitally signed message part

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de
https://mailman.rwth-aachen.de/mailman/listinfo/procmail