#!/usr/bin/perl $script_path = './smailB.cgi'; $sendmail_path = '/usr/sbin/sendmail'; if($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buf, $ENV{'CONTENT_LENGTH'}); @data = split(/&/, $buf); foreach (@data) { ($name,$value) = split(/=/, $_); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $decode_data{$name} = $value; } $add = $decode_data{'add'}; $sub = $decode_data{'sub'}; $comment = $decode_data{'comment'}; $send_data = << "MESSAGE"; Return-Path: <$add> Received: (from your\@host) by www.yourhost.net(00.00.00/00.00.00) id 000000000000; Sat, 0 Dec 0000 00:00:00 +0900 Reply-To: $add<$add> Errors-To: $add X-Originating-IP: [0.0.0.0] Message-Id: <000000000000> Date: Sat, 0 Dec 0000 00:00:00 +0900 From: $add To: $add Subject: $sub $comment . MESSAGE $send_data =~ s/\x0D\x0A|\x0D|\x0A/\r\n/g; open(MAIL, "| $sendmail_path -t") || &Error("sendmail open error"); print MAIL $send_data; close(MAIL); print "Content-Type: text/html\r\n\r\n"; print << "END"; SUCCESS!!

RETURN END }else{ print "Content-Type: text/html\r\n\r\n"; print << "HTML"; sendmail test
mailaddr:
subject :


HTML } exit; sub Error { print "Content-Type: text/html\r\n\r\n"; print << "HTML"; $_[0] $_[0]

RETURN HTML exit; }