delete mail with procmail

delete mail with procmail

Posted by: ellinj
Posted on: 2003-02-25 05:23:00

Anyone have an example of how to delete or better yet delete an email using procmail. I have a particular email that I keep getting from a spammer (at least five times a day) Rather then have spamassasin remove it I would like to just plain delete or bounce it so I never see it.

I have tried this but it doesn't seem to work.


MAILDIR=$HOME/Maildir
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log

:0
* ^(From.*yahoo.com
{
EXITCODE=77
:0
/dev/null
}



INCLUDERC=$PMDIR/spam.rc
:
$HOME/Maildir/

Re: delete mail with procmail

Posted by: will
Posted on: 2003-02-25 07:08:00


> :0
> * ^(From.*yahoo.com

What's the '(' for? It should be something like:
:0
* ^From:.*@yahoo.com
/dev/null

Are you sure you really want to /dev/null mail from any address at yahoo.com?

> {
> EXITCODE=77
> :0
> /dev/null
> }

I think this is probably unnecessary.

> INCLUDERC=$PMDIR/spam.rc
> :
> $HOME/Maildir/

Is this actually:
:0
or do you really just have ':' there?

If you're still having problems, check your permissions on all procmail related files (make sure they're not group or other writable), and turn on logging so that you can see what's happening. Turn on verbose logging if necessary (VERBOSE=yes).

Re: delete mail with procmail

Posted by: ellinj
Posted on: 2003-02-25 17:37:00

Changed the rule to as follows.
MAILDIR=$HOME/Maildir
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
VERBOSE=yes
:0
* ^From:.*@yahoo.com
/dev/null

:0
$HOME/Maildir/

Get the following in the log file.

From jeffellin@yahoo.com Tue Feb 25 17:36:00 2003
Subject: test
Folder: /home/ellinj/Maildir/new/1046223361.26005_0.willum 848

Any idea? I only am using @yahoo.com for testing since I can send an email from there to my domain.

THanks



Re: delete mail with procmail

Posted by: will
Posted on: 2003-02-26 13:57:00

From my earlier message:

> check your permissions on all procmail related files

Your permissions were wrong. Procmail doesn't like group-writable files. I set your permissions correctly for you, so this should work now. I'd make directories 0700 (drwx------) and files 0600 (-rw-------).

Try putting "umask 022" in your .bash_profile or .cshrc (depending on which shell you're using), so that new files aren't group writable.

Re: delete mail with procmail

Posted by: ellinj
Posted on: 2003-02-26 16:10:00

Will,
Now I can't see the the files .procmail since they are owned by sas for some reason. I switched to sas and try'd
[frigga]$ whoami
sas
[frigga]$ chown ellinj .procmailrc
chown: changing ownership of `.procmailrc': Operation not permitted

Whats up with that message?

Re: delete mail with procmail

Posted by: will
Posted on: 2003-02-26 16:23:00

That's ~ellinj.procmail/.procmailrc (which isn't the file you need to change).

~ellinj/.procmailrc is owned by your user. Probably you created those other files when you were logged in as the other user.

You can't chown files as your user; I did:
willum: 04:21pm# find . -user sas -exec chown ellinj:pg61835 {} ;

All files should now be owned by you.

Re: delete mail with procmail

Posted by: ellinj
Posted on: 2003-02-27 06:57:00

Thanks will,
It would appear that my scripts weren't working because I was editing the wrong file. I must have copied my .procmailrc to the .procmail directory as a backup, which got me all confused when I went to edit my scripts several monthes later.

Thanks for all your help.

Jeff

Tags: mailemailprocmailspamassasindev nullspammerbouncespam