forwarding spam to a certain folder
Valmiki N. Ramsewak
lilvalo at MIKIBOY.COM
Thu Jul 15 17:22:59 IST 2004
On Thu, Jul 15, 2004 at 12:12:25AM -0500, Valmiki N. Ramsewak wrote:
> On Wed, Jul 14, 2004 at 10:23:50AM -0500, Valmiki N. Ramsewak wrote:
> > Hi,
> > If you read the really small thread, 'custom function' it
> > describes my problem perfectly well.
> > Well now I'm taking one step back, I'm open to a different way of
> > implementing it. I'm using postfix for virtual mail users, that is driven
> > by a mysql. Basically from what I've read from googling, procmail doesn't
> > work well with virtual users.
> >
> > So I'm open to suggestions on how to do this, or if you feel like
> > telling me how to code what I've been trying to and can't (read the
> > 'custom function' thread) I'd be happy with that to :)
Yes my overjoyed post to the list at midnight last night was my joys of me
figureing out how to get the thing to work :)
-- start code--
sub InternalForward {
my($fromac, $fromdomain, $final, $touser, $addr, $user, $domain);
my($message) = @_;
open FILE, ">>/tmp/out.txt" or die "can't open";
foreach $addr (@{$message->{to}}) {
$user = $addr;
$domain = $user;
$user =~ s/\@.*$//; # Leave everything before @
$domain =~ s/^.*\@//; # Leave everything after @
print FILE $user . '@';
print FILE $domain . ' ';
}
$final = 'foward ' . $user . '-spam@' . $domain;
MailScanner::Log::InfoLog("%s", $final);
print FILE $final . "
";
close FILE;
return $final;
}
-- end code--
umm all the file statemetns in tehre were for me debugging crap... i'll
prolly comment it out when i'm happy.. it seems to work happily well, even
when tehre are multiple receipted in the to or cc field and these
reciepents addresses don't need to be modified...
anyone suggestions to make it better will be greatly appreciated
now to jus write a php page to make user and the user-spam entry in one
go... (piece of cake compared to this frelling thing)
and thanks for the help guys!!!!!!!!!!!
valmiki
--
Got Speed?
www.mikiboy.com
aim: lilvalo
-------------------------- MailScanner list ----------------------
To leave, send leave mailscanner to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/ and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html
More information about the MailScanner
mailing list