bbsmail.in
上传用户:minyiyu
上传日期:2018-12-24
资源大小:864k
文件大小:2k
- #!@PERL@ -U
- # $Id: bbsmail.in,v 1.1 2000/01/15 01:45:41 edwardc Exp $
- $bbsuid=@BBSUID@;
- $bbsgid=@BBSGID@;
- $mail2bbs="@BBSHOME@/bin/mail2bbs";
- require "@BBSHOME@/bin/mailgate.pl";
- $)=$bbsgid;
- $(=$bbsgid;
- $<=$bbsuid;
- $>=$bbsuid;
- $ENV{'PATH'}='/bin:/usr/etc:/usr/local/bin:/usr/ucb';
- while ( $ARGV[0] =~ /^-/ ) {
- $_ = shift;
- if ( /^-d/ ) {
- $debug=1;
- }
- }
- $normaluser = $ARGV[0];
- $logdir="/home/bbs";
- mkdir($logdir,0700) unless -d $logdir;
- open(LOG,">> $logdir/mail-log") || warn "can't open warn file $!n";
- print LOG "n";
- print "nMail to $normaluser n";
- print LOG "Mail to $normaluser n";
- &readmail;
- for ($n=0; $n < $MAILBODY; $n++) {
- print LOG $MAIL[$n];
- }
- print LOG "'$Header{'From'}' '$normaluser' '$Header{'Subject'}' '$Header{'Received'}' '$Header{'Reply-To'}' '$Header{'To'}' n";
- open(BBSGATE,"| $mail2bbs '$Header{'From'}' '$normaluser' '$Header{'Subject'}' '$Header{'Received'}' '$Header{'Reply-To'}' '$Header{'To'}' ");
- for ($n= $MAILBODY; $n <= $#MAIL; $n++) {
- print BBSGATE $MAIL[$n];
- }
- close(BBSGATE);
- if ($? ==0 ) {
- print LOG "$Header{'From'} mail to $normaluser successfullyn";
- print "$Header{'From'} mail to $normaluser successfullyn";
- } elsif ($? ==767 ) {
- print LOG "$Header{'From'} mail to $normaluser failed, return code $?n";
- print "$Header{From} mail to $normaluser failed, return code $?n";
- close(LOG);
- die "Shared memory errorn";
- } elsif ($? ==768 ) {
- print LOG "$Header{'From'} mail to $normaluser failed, return code $?n";
- print "$Header{From} mail to $normaluser failed, return code $?n";
- close(LOG);
- die "Service refusedn";
- } else {
- print LOG "$Header{'From'} mail to $normaluser failed, return code $?n";
- print "$Header{From} mail to $normaluser failed, return code $?n";
- close(LOG);
- die "BBS user $normaluser unknownn";
- }
- close(LOG);
- 0;