⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reply_mail.cgi

📁 Unix下基于Web的管理工具
💻 CGI
字号:
#!/usr/local/bin/perl# Display a form for replying to an emailrequire './sendmail-lib.pl';require './boxes-lib.pl';&ReadParse();&can_read_mail($in{'user'}) || &error($text{'reply_ecannot'});if ($in{'new'}) {	# Composing a new email	&header($text{'compose_title'}, "");	}else {	# Replying or forwarding	@mails = &list_mails($in{'user'}, $in{'idx'}, $in{'idx'});	$mail = $mails[$in{'idx'}];	if ($in{'delete'}) {		&delete_mail($mail, $in{'user'});		&redirect("list_mail.cgi?user=$in{'user'}");		exit;		}	&header($in{'forward'} ? $text{'forward_title'}			       : $text{'reply_title'}, "");	&parse_mail($mail);	if (!$in{'forward'}) {		$to = $mail->{'header'}->{'reply-to'};		$to = $mail->{'header'}->{'from'} if (!$to);		}	$cc = $mail->{'header'}->{'to'}.", ".	      $mail->{'header'}->{'cc'} if ($in{'reply2'});	$subject = $mail->{'header'}->{'subject'};	$subject = "Re: ".$subject if ($subject !~ /^Re/i && !$in{'forward'});	$subject = "Fwd: ".$subject if ($subject !~ /^Fwd/i && $in{'forward'});	@attach = @{$mail->{'attach'}};	foreach $a (@attach) {		if ($a->{'type'} eq 'text/plain') {			$body = $a;			@lines = split(/\n/, $body->{'data'});			foreach $l (@lines) {				$quote .= "> $l\n";				}			last;			}		}	$quote = $mail->{'header'}->{'from'}." wrote ..\n".$quote if ($quote);	if ($in{'forward'}) {		@attach = grep { $_ ne $body } @attach;		}	else {		undef(@attach);		}	}print "<hr>\n";print "<form action=send_mail.cgi method=post enctype=multipart/form-data>\n";print "<input type=hidden name=user value='$in{'user'}'>\n";print "<input type=hidden name=idx value='$in{'idx'}'>\n";print "<input type=hidden name=new value='$in{'new'}'>\n";print "<table width=100% border=1>\n";print "<tr> <td $tb><b>$text{'reply_headers'}</b></td> </tr>\n";print "<tr> <td $cb><table width=100%>\n";print "<tr> <td><b>$text{'mail_from'}</b></td>\n";if ($access{'fmode'} == 0) {	print "<td><input name=from size=50 value='",	      $in{'user'},'@',&from_hostname(),"'></td> </tr>\n";	}elsif ($access{'fmode'} == 1) {	print "<td><select name=from>\n";	foreach $f (split(/\s+/, $access{'from'})) {		print "<option>$in{'user'}\@$f\n";		}	print "</select></td>\n";	}else {	print "<td><select name=from>\n";	foreach $f (split(/\s+/, $access{'from'})) {		print "<option>$f\n";		}	print "</select></td>\n";	}print "<tr> <td><b>$text{'mail_to'}</b></td> ",      "<td><input name=to size=50 value='$to'></td> </tr>\n";print "<tr> <td><b>$text{'mail_cc'}</b></td> ",      "<td><input name=cc size=50 value='$cc'></td> </tr>\n";print "<tr> <td><b>$text{'mail_subject'}</b></td> ",      "<td><input name=subject size=50 value='$subject'></td> </tr>\n";print "</table></td></tr></table><p>\n";print "<table width=100% border=1><tr><td $cb>",      "<textarea rows=20 cols=80 name=body>",$quote,      "</textarea></td></tr></table><p>\n";# Display other attachmentsif (@attach) {	print "<table width=100% border=1>\n";	print "<tr> <td $tb><b>$text{'reply_attach'}</b></td> </tr>\n";	print "<tr> <td $cb>\n";	foreach $a (@attach) {		push(@titles, $a->{'filename'} ? $a->{'filename'}					       : $a->{'type'});		push(@links, "detach.cgi?user=$in{'user'}&idx=$in{'idx'}&attach=$a->{'idx'}");		push(@icons, "images/boxes.gif");		print "<input type=hidden name=forward value=$a->{'idx'}>\n";		}	&icons_table(\@links, \@titles, \@icons, 8);	print "</td></tr></table><p>\n";	}# Add form for more attachmentsprint "<table width=100% border=1>\n";print "<tr> <td $tb><b>$text{'reply_attach2'}</b></td> </tr>\n";print "<tr> <td $cb>\n";foreach $i (0 .. 5) {	print "<input type=file name=attach$i>\n";	}print "</td></tr></table><p>\n";print "<input type=submit value='$text{'reply_send'}'></form>\n";print "<hr>\n";&footer("list_mail.cgi?user=$in{'user'}", $text{'mail_return'});

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -