homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

Using procmail, php and mysql to blacklist email
David Bruning

10+ Year Member

Msg#: 4063841 posted 9:51 pm on Jan 19, 2010 (gmt 0)

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

:0 Wa

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



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

Msg#: 4063841 posted 12:07 am on Jan 20, 2010 (gmt 0)

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.

* ^X-Real-Junk: Yes

Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved