[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] RaQ4 - Blocking e-mail



"Tim Skipper" <mailinglists@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> How can I block, preferably on a site-by-site basis if possible,
> e-mail being accepted from a given domain?

Tim, use procmail, which is already installed on your RaQ4.  Do the
following.

0. Backup ~username directory.
1. cd ~username
2. Create .procmailrc containing the following:

SHELL=/bin/sh
VERBOSE=off
MAILDIR=$HOME/mail
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/rc.spam

3. chmod 640 .procmailrc
4. mkdir .procmail
5. cd .procmail
6. Create rc.spam

:0:
    * ^From: .*(domain1.tld|domain2.tld|domain3.tld|\
                       domain4.tld|domain5.tld|domain6.tld)
    /dev/null

7. chmod 755 ~username; chmod g+s ~username

The procmail recipe above means "Any email with a From header matching
anything ending in one of those 6 domains should be delivered to /dev/null,
which in essence deletes the email."  FYI, the "\" in the rule above is
needed so that the whitespace that follows isn't interpreted literally.
This doesn't technically block the email as it *is* received by the server
and therefore uses bandwidth, but the user will never see the email.  Like
others have suggested there are solutions to block email from certain IPs,
hostnames or email addresses so that it's never received, but that is done
on a global basis, not a user by user basis.  You did ask for a
site-specific solution, so you'd want to go through this process for each
user on the site, though it may be possible to use symbolic links and/or
centralize the recipe and log location for each site by modifying
.procmailrc, though I've never tried that.  I use procmail extensively for
routing, blocking, copying and zipping email, returning files to the sender,
triggering programs, etc. so it's a very powerful program that can do much
more than delete email.  If you'd like to learn more about it I suggest
doing a search on google.com for procmail and spending 30 minutes reading
info. on various related sites.  If you have a specific problem with my
instructions or something related let us know.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/