procmail
[Top] [All Lists]

Re: remotely add text to a file

2001-08-14 07:27:50
* Matt Dunford <zoot(_at_)zotikos(_dot_)com> [20010814 15:04]: writing on the 
subject 'Re: remotely add text to a file'
* Luka Kladaric <lkladar(_at_)komoseva(_dot_)globalnet(_dot_)hr> [010814 
06:35]:
Hi all y'all :))

I use a few variations of the following filter to perform spam filtering.

:1
? /bin/fgrep -i -f $PMDIR/crap-b.lst
{
        # EXITCODE = 77
        :0:$PMDIR/lock
        | /usr/bin/formail -A "X-Spam: yes - bounced - permission denied" >>
$DEFAULT
}

I was wondering if there was a way (or someone has a ready solution) to
remotely add a line into the files that the filters grep?

I often go on vacation where I don't have the ability to login to my account
where I run procmail (it requires SSH), but I recieve mails on my cell
phone. I can also send mails from my cell phone so it would be great if I
could filter out an email address, or any other marker by simply sending an
email to myself with the proper contents.

Sounds risky, but here's an idea.  Say you send yourself an email that
looks sort of like this:

    From: Me <me(_at_)some(_dot_)address>
    Subject: add to spam list
    [... other headers ...]

    spam_line_here

The recipe could work like this:

# add the first line from the body to spam word list
:0b:$PMDIR/lock
* ^From: Me <me(_at_)some\(_dot_)address>
* ^Subject: add to spam list
| sed -n 1p >>$PMDIR/crap-b.lst

Just an idea, untested..


Hi Matt,

It's me again - the Kenyan bug ;-)

I saw this and went ahead to test it but it ends up creating a file called
$ which apparently takes all newly incoming mail.

Here is what I tested:

# add the first line from the body to spam word list
:0b:$PMDIR.lock
* ^From: $LOGNAME
* ^Subject: weird-add
| sed -n 1p >> $PMDIR/.weird

I am not familiar with sed (still pleading with 'boss' to buy Unix Power
Tools) but I was looking at this as a good idea that I can use in a global
procmailrc (with a few tweaks) to enable my users here to add/remove a
.forward in their $HOME which contains an alternate e-mail address which
they want e-mails forwarded to. Then later they can send an e-mail with
the subject weird-remove and the sed portion copies /dev/null to the
.forward , nice idea?? The only hitch here is that it's not creating the
file .weird but just puts the e-mail in $DEFAULT.

May you be willing to make another 'untested one' that creates the
file? ;-)

Thanks for your time.


-Wash

--
Odhiambo Washington
Wananchi Online Ltd.,
wash(_at_)wananchi(_dot_)com 1st Flr Loita Hse.
Tel: 254 2 313985 Loita Street.,
Fax: 254 2 313922 PO Box 10286,00100-NAIROBI,KE.

Habit and routine have an unbelievable power to waste and destroy. 
-Henri de Lubac, "Paradoxes" 

Attachment: pgp1CCRNO90UZ.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>