Welcome to WebmasterWorld Guest from 54.162.157.136

Forum Moderators: phranque

Message Too Old, No Replies

Using procmail, php and mysql to blacklist email

     
9:51 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



Hi guys,

I'm in the process of setting up a system where new email comes in, hits procmail, is sent to a .sh script, uses php to access mysql to identify if the sending IP is in my blacklist and delete it if it is.

I have my procmailrc using this recipe while I test things:

:0 Whic:test.lock
* ^To:.*testemail
/www/path/emailprotection.sh

:0 Wa
/dev/null

I am able to have my script identify if an email should be let through or deleted, but I am having problems sending that information back to procmail so it can delete the blacklisted emails.

If you happen to have gone through something similar, or have some suggestions, I would dearly love to hear them :)

The shell/php script takes the header of the email, identifies the originating IP address and checks the mysql database...everything tests well and I end up with 2 possible variables called $safe and $bad. I guess the question is, how do I (if it's possible) have the procmail delete the email if the originating IP ends up tagged to the $bad variable.

I looked around to see if I could find the best place to put this question, hopefully this was suitable :)

12:07 am on Jan 20, 2010 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



procmail checks the contents of the email after processing. You could add an extra header line to the message, for example X-Real-Junk: Yes. The following procmail lines will send that message then to the write-only /dev/null mailbox.

:0:
* ^X-Real-Junk: Yes
/dev/null

 

Featured Threads

Hot Threads This Week

Hot Threads This Month