#!/usr/local/bin/perl #日本語コード変換ライブラリ #ダウンロード先↓ #ftp://ftp.iij.ad.jp/pub/IIJ/dist/utashiro/perl/ require './jcode.pl'; #フォームデコード用ライブラリ #ダウンロード先↓ #http://www.bio.cam.ac.uk/cgi-lib/ require './cgi-lib.pl'; #フォームから送られたデータをメール形式で送ります。 $title = 'メルMail'; #当スクリプト $script_file = './m-basic.cgi'; #メールの送り先アドレス $sendoto = 'admin@story-maker.jp'; # sendmailへのパス(環境によって設定してください) $sendmail = '****'; #cgi-lib.plの関数。これを呼び出すとフォームの内容が%inに格納される &ReadParse; #いったんフォームデータを変数に入れる $name = "$in{'name'}"; $subject = "$in{'subject'}"; $mail = "$in{'mail'}"; $body = "$in{'body'}"; #メールの内容のエンコード(jis) &jcode'convert(*name,'jis'); &jcode'convert(*subject,'jis'); &jcode'convert(*body,'jis'); #メール送信 open(MAIL, "| $sendmail -t") || &error("送信エラー","メールが送信できません。"); print MAIL "To: $sendoto\n"; print MAIL "From: $mail\n"; print MAIL "Subject: $subject\n"; print MAIL "Content-Type: text/plain;\n\n"; print MAIL "名前: $name\n"; print MAIL "Mail: $mail\n"; print MAIL "$body\n"; close(MAIL); #メール本文の改行を
に変換 $body =~ s/\r\n/
/g; $body =~ s/\n/
/g; #完了表示 print "Content-type: text/html\n\n"; print "\n"; print "$title\n"; print "\n"; print "

$title


\n"; print "以下のメールを送信しました
"; print "送信先: $sendoto
\n"; print "名前: $name
\n"; print "メールタイトル: $subject
\n"; print "メールアドレス: $mail
\n"; print "本文: $body\n
"; print "
"; print "
■CLOSE
"; print "\n"; exit; ########################################################### #エラー表示 sub error { #ローカル変数の設定 #@_は引数の配列 local (@msg) = @_; local ($i); print "Content-type: text/html\n\n"; print <<"EOF"; $_[0]

$_[0]

EOF print "\n"; print "\n"; exit; }