#! /usr/local/bin/perl require 'jcode.pl'; $sendmail = '/usr/lib/sendmail'; $to = 'doitokeiya@mx41.tiki.ne.jp '; $ENV{'TZ'} = "GMT-9"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour < 10) { $hour = "0$hour"; } $month = ($mon + 1); @wday_array = ('SUN','MON','TUE','WED','THU','FRI','SAT'); $date_now = "$month/$mday/$wday_array[$wday] $hour:$min:$sec"; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } if ($buffer eq "") { &send_error; } @pairs = split(/&/,$buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($name eq "kakunin" && $value eq "ok") { $kakunin = "ok"; } else { if ($name eq "email") { $value =~ s/ //g; $value =~ s/ //g; $email = $value; } #if ($name eq "to") { # $to = $value; #} if ($name eq "subject") { $subject = $value; } if ($name eq "nexthtm") { $nexthtm = $value; } &jcode'convert(*name,'jis'); &jcode'convert(*value,'jis'); push(@DATA_N,$name); push(@DATA_V,$value); &jcode'convert(*name,'sjis'); &jcode'convert(*value,'sjis'); $value =~ s/\n//g; $value =~ s/\r/\r\n/g; $name =~ s/\</g; $value =~ s/\</g; $name =~ s/\>/>/g; $value =~ s/\>/>/g; $name =~ s/\"/"/g; $value =~ s/\"/"/g; push(@DATA_NS,$name); push(@DATA_VS,$value); } } if (!($email =~ /(.*)\@(.*)\.(.*)/)) { $email = 'homepage@doitokeiya.com'; } ####変更箇所1######################### # &jcode'convert(*subject,'jis'); &jcode'convert(*subject,'sjis'); ######################################## if ($kakunin eq "ok") { &sendmail; } print "Content-type: text/html\n\n"; print "
\n"; exit; sub sendmail { ###変更箇所2########################### $subject = &mail64encode($subject); ######################################## if (!open(OUT,"| $sendmail $to")) { &send_error; } print OUT "To: $to\n"; print OUT "From: $email\n"; print OUT "Subject: $subject\n"; print OUT "Content-Transfer-Encoding: 7bit\n"; print OUT "Content-Type: text/plain\n"; print OUT "\n\n"; $count = @DATA_N; foreach (2..$count-1) { if ($DATA_V[($_)] =~ /\n/) { print OUT "$DATA_N[($_)] =\n$DATA_V[($_)]\n"; } else { print OUT "$DATA_N[($_)] = $DATA_V[($_)]\n"; } } print OUT "\n"; close(OUT); #print "Location: $location\n\n"; print "Content-type: text/html\n\n"; print "