2 ################################################################################
4 # File: $RCSfile: MAPSDeliver,v $
5 # Revision: $Revision: 1.1 $
6 # Description: This script simply delivers the mail. It is separated out so
7 # it can be the only portion that is setgid to the group mail
8 # for the purposes of being able to deliver the mail to the users
10 # Author: Andrew@DeFaria.com
11 # Created: Fri Nov 29 14:17:21 2002
12 # Modified: $Date: 2013/06/12 14:05:47 $
15 # (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
17 ################################################################################
23 use lib "$FindBin::Bin/../lib";
30 my ($userid, $msgfileName) = @_;
33 open my $maildrop, '>>', "/var/mail/$userid"
34 or return "Unable to open maildrop file (/var/mail/$userid): $!";
37 open my $msgfile, '<', $msgfileName
38 or return "Unable to open msgfile ($msgfileName): $!";
43 # Write msgfile -> $maildrop
44 print $maildrop "\n\n";
45 print $maildrop $_ while (<$msgfile>);
58 my ($userid, $msgfile) = @ARGV;
60 die 'User id not specified' unless $userid;
61 die 'Msgfile not specified' unless $msgfile;
63 my $err = DeliverMail($userid, $msgfile);
66 OpenDB('maps', 'spam');