Delete mail with procmail


#1

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/


#2

[/quote]

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?

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

[/quote]

I think this is probably unnecessary.

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

[/quote]

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).


#3

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


#4

From my earlier message:

[quote]check your permissions on all procmail related files

[/quote]

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.


#5

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?


#6

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.


#7

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


#8

Hello we have a procmail which is posted below:-
Unfortunately it does not reject mails greater than 2MB. Could some one help on the below script to tune it so that it rejects the incoming mail greater than 2MB.
Thanks in Advance…

SHELL = /bin/sh
PATH = /bin:/usr/bin:/usr/local/bin
MAILDIR = /var/mail
LOCKFILE = ${HOME}/.lockmail

#LOGFILE =
#LOGABSTRACT = “all”
#VERBOSE = “on”

:0

  • 2097152

  • !^FROM_DAEMON
  • !^FROM_MAILER
    | ( echo “This mail is over the 2MB size limit and can not be processed”;
    /usr/bin/formail -rk ) |
    /usr/sbin/sendmail -t -oi

:0 W
{
:0
dest=| /home/eistc/bin/addressrobin.sh
:0
! ${dest}
}


#9

It doesn’t appear that you’re a DreamHost customer.

We no longer support .procmailrc filtering. Indeed, we haven’t for quite a while — the thread you’re replying to is over ten years old!