sentmail.pl
上传用户:dostar
上传日期:2007-01-04
资源大小:21k
文件大小:3k
- #!/usr/local/bin/perl
- BEGIN { $APP_PATH=$0; $APP_PATH=~s/(/*)[^/]+$/$1/g; }
- # @ ----------------------------------------------------------------------------------------------------------
- # @ This code is (c) 1999 Alexandre Aufrere and NikoSoft.
- # @ Published under NPL rights, meaning you have the right
- # @ to use and modify this code freely, provided it
- # @ remains available and free. Any modified code should be
- # @ submitted to Nikopol Software Corp. or Alexandre Aufrere.
- # @ This code is protected by the French laws on Copyright.
- # @ Please note that there it comes with NO WARRANTY of any kind,
- # @ and especially for any damagbe it could cause to your computer
- # @ or network.
- # @ Using this code means you agree to this license agreement.
- # @ Further information at http://aufrere.citeweb.net/nsc/
- # @ ----------------------------------------------------------------------------------------------------------
- # @
- # @ Project NS WebMail
- # @
- # @ Filename sentmail.pl
- # @
- # @ Description outbox manager for NS WebMail
- # @
- # @ Version 1.0
- # @
- # @ ----------------------------------------------------------------------------------------------------------
- require $APP_PATH."config.pl";
- &ReadParse;
- $loginname = $in{'loginname'};
- $password = $in{'password'};
- $POPserver = $in{'POPserver'};
- $lastMsg = $in{'lastMsg'};
- $deleteMsg = $in{'deleteMsg'};
- $cache = $in{'cache'};
- #Begin production of HTML code.
- print "Content-type: text/htmlnn";
- print "<HTML><HEAD><TITLE>NSWM Sent Mail Managment</TITLE>";
- if ($cache eq "No") { print "<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>";
- print "</HEAD>n<BODY BGCOLOR='#FFFFFF'>";
- }
- else { print "</HEAD>n<BODY BGCOLOR='FF8F8F'>";
- }
- $logfilename=$LOG_PATH.$loginname."@".$POPserver.".log";
- open (f, "$logfilename");
- @msgsentlist=<f>;
- close (f);
- @msgsentlist=reverse(@msgsentlist);
- $i=0;
- print "n<table border=0 cellpadding=2 cellspacing=0 width=90% align=center>n";
- print "<tr bgcolor=darkblue><td><b><font color=white>$totext</b></td><td><b><font color=white>$subjecttext</b></td><td><b><font color=white>$datetext</b></td></tr>n";
- foreach $msg (@msgsentlist) {
- ($msgdate,$msgto, $msgsubject)=split(";",$msg);
- if ( (($i)/2) == int(($i)/2) ) {
- print "<tr>n";
- } else {
- print "<tr bgcolor=lightblue>n";
- }
- $msgto=~ s/</</g;
- $msgto=~ s/,/<br>n/g;
- print "<td>$msgto</td><td>$msgsubject</td><td><font size=-1>$msgdate</font></td></tr>n";
- $i++;
- }
- print "</table>";
- print"</BODY></HTML>";
- exit;
- ###############################################################################
- sub ReadParse {
- local(*in)=@_ if @_;
- local ($i,$key,$val);
- if ($ENV{'REQUEST_METHOD'} eq "GET") {
- $in=$ENV{'QUERY_STRING'};
- }
- elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
- read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
- }
-
- @in=split(/&/,$in);
-
- foreach $i (0 .. $#in) {
- $in[$i] =~ s/+/ /g;
- ($key,$val)=split(/=/,$in[$i],2);
- $key =~ s/%(..)/pack("c",hex($1))/ge;
- $val =~ s/%(..)/pack("c",hex($1))/ge;
- $in{$key} .= "