block sender + use with maildrop
"Copysan S" <[email protected]>
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <[email protected]> |
Dear All ,
Right now I can use the block_sender plugin only with procmail,but if
a slight modification on php code, we can use the same plugin for
maildrop also.
This is the only change to use block_sender pluging to use with
maildrop (copy this sample maildroprc to /etc/maildroprc ), I take
this code from spamrule plugin and modified it.
[root@gejo block_sender]# cat /etc/maildroprc
##
# /usr/local/etc/maildroprc: global maildrop config file
#
# See maildropfilter(5) and http://www.flounder.net/~mrsam/maildrop/
# for more info.
#
# $Id: maildroprc,v 1.10 2003/07/01 07:40:24 root Exp root $
##
DEFAULT="$HOME/Maildir"
logfile "/var/log/maildroprc.log"
MAILDIR="$DEFAULT"
FILTER="/var/local/squirrelmail/data"
FILTERS="$FILTER/$LOGNAME.maildropblock"
VERBOSE 9
# where to deliver mail by default
# where to send junk mail
JUNK="$MAILDIR/.Junk"
TRASH="$MAILDIR/.Trash"
# junk filter tag
JUNK_TAG="X-Spamrule"
# virus filter tag
VIRUS_TAG="X-Antivirus"
# where to send virus-infected mail
VIRUS_BOX="/usr/mail/quarantine"
# sitewide filter tag
SITEWIDE_TAG="X-Global-filter"
# what shell to use for system commands
SHELL=/bin/sh
# The exit code that will tell qmail-local to stop processing a user's
# .qmail and don't try delivering the given message any more:
# 99 = tell qmail that the message was delivered successfully (blackhole it)
# 100 = tell qmail that the delivery failed permanently (reject it)
# (See qmail-command(8) for more info.)
EXIT_BLACKHOLE=99
EXIT_REJECT=100
# Immediately deliver mail from system accounts to the user's mailbox,
# bypassing any filters they may have
# (This looks a lot like the always-allow rule)
exception {
import SENDER
SHELL=/bin/sh
BLOCKED=$FILTERS
# is the envelope sender in the allowed senders list?
if (lookup($SENDER, "$BLOCKED"))
{
xfilter "reformail -A '$JUNK_TAG: allowed: sender \"$SENDER\"
overrides filters'"
to $TRASH
}
# what about the header sender?
/^From: .*/
foreach (getaddr $MATCH) =~ /.+/
{
if (lookup($MATCH, "$BLOCKED"))
{
xfilter "reformail -A '$JUNK_TAG: allowed: sender \"$MATCH\"
overrides filters'"
to $TRASH
}
}
}
This is the area which needs php code modifications .Right now I am
creating this file by using sed command .if modify our code to change
[email protected] to ^gejo@bos\.test\.co\.in$ . and save the output
on $LOGNAME.maildropblock .,so that all the users can enjoy by use
the same code for maildrop filtering also.The output contains two
files $logname.block and $logname.maildropblock
[root@gejo block_sender]# cat
/var/local/squirrelmail/data/[email protected]
^gejo@bos\.test\.co\.in$
^billing@aloha\.net$
^feedback@aloha\.net$
[root@gejo block_sender]# cat /var/local/squirrelmail/data/[email protected].
[email protected]
[email protected]
[email protected]
I tested the same and it is working fine
Regards
Gejo
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
-----
squirrelmail-devel mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel