On Tuesday 05 June 2007 16:37:09 Gordon Messmer wrote:
> > a particular user is allowed to send email to only list of authorized
> > mail address - say a list of 20 people , he should not be allowed to
> > send mail to anybody besides the people on this list
> 
> No.  In particular, it's pretty much impossible to reliably identify 
> persons sending mail.

Here's a perl filter stub that logs the sender and
receivers email address and could succeed or fail
depending on a database or dictionary lookup to
match the $from and $to vars.

use IO::File;

my $filedesc=shift @ARGV;
my $socket=new IO::File "+<&$filedesc";
die "$!" unless defined $socket;

my $errmsg="200 Ok";
my $datafile="";
my $ctrlfile="";
my $from="";
my $to="";

$datafile=<$socket>;
$ctrlfile=<$socket>;

open(IN, $ctrlfile);
while (<IN>) {
  $from = $_ if s/^s(.+)\s+$/$1/;
  $to = $_ if s/^r(.+)\s+$/$1/;
}
close(IN);

# do DB lookup comparison here and set $errmsg to
# anything other than "200 Ok" to deny sending, ie;
# $errmsg = "500 Not allowed to send to this address".

print $socket $errmsg;
$socket->close;

open(LOG, '>> /var/log/filtercontrol.log');
print LOG "FROM=$from -> TO=$to\n";
close(LOG);

--markc

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to