Re: procmail expert needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

On Mon, 6 Oct 2003 22:18:42 -0400, Eric Wood wrote:

> The procmail maillist list isn't working for me... may be down.  So I'll try
> here..
> 
> 
> Basically I want search for key terms only after stripping the HTML from the
> message because many spammers split up words with fake html tags, ie
> vi<ewgfweg>agr<grwj>a.
> 
> The sed trick strips out all html-like tags.  Cool.  Except I'm trying to
> figure out a way to un-do the stripping if the words I'm looking for isn't
> in the body of the message after all.  So far the stripped message gets
> delivered to the mailbox regardless.
> I need to do something like this:
> 
> preserve_copy_of_message_here
>   :0fwb
>   | sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
>   :0B
>   * (v'agra)
>   {
>     OBSCENE_=adult-trap
>     :0
>     /dev/null
>   }
> if OBSCENE is set, then do nothing cause message went to /dev/null, else
> send the original message to the mailbox.
> 
> Any ideas?

Not a straight-forward implementation, just an idea. 

A problem certainly is that you modify the message right away. One 
technique to avoid that is to pass the message text to a subshell for
analyzation, insert a custom header (e.g. X-Procmail: some-flag-here)
into the original message and pass that one back to procmail. All
recipes are processed again, and you can check the custom header on
what to do with the message. Similar to the following unchecked
recipes:

# Pass 1. Analyze the message body of message which don't contain
# an X-Procmail header. Set the X-Procmail header, then return the
# complete message to procmail.
:0
* ! ^X-Procmail:.*
{
    SPAM_FLAG=$(sed -e '1,/^$/ d' | your-de-html-analyzer-here)
    :0HB
    | formail -A "X-Procmail: $SPAM_FLAG" -s procmail
}

# Pass 2. Process messages which have an X-Procmail header.
:0
* ^X-Procmail: OBSCENE
/dev/null

Of course, pass 2 can contain nested recipes, too.

- -- 
Michael, who doesn't reply to top posts and complete quotes anymore.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/gxVG0iMVcrivHFQRAuzIAJ42i3tyff2ajZYFhy98ley692GGdACfaHzY
mp0suw+dmvd00Eb8WjJrUuU=
=OJxw
-----END PGP SIGNATURE-----


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux