# $mailto, $fromaddr に自分のメールアドレスを設定し、テストする use Jcode; use MIME::Base64 (); $sendmail = 'c:\sendm\sendmane.exe'; $mailto = 'user@example.com'; $fromaddr = 'user@example.com'; $subject = "テストメール(Perl)"; Jcode::convert(\$subject, 'jis'); $subject = MIME::Base64::encode($subject); chomp($subject); $subject = "=?ISO-2022-JP?B?$subject?="; $name = "差出人名"; if($name =~ /[^\w\s]/) { Jcode::convert(\$name, 'jis'); $name = MIME::Base64::encode($name); chomp($name); $name = "=?ISO-2022-JP?B?$name?="; } $from = "$name <$fromaddr>"; $mailbody = <<"_MAILBODY_"; Sendまね〜るを使ったメール送信 Perlスクリプトのサンプルです。 _MAILBODY_ Jcode::convert(\$mailbody, 'jis'); $mailtext = <<"_MAIL_"; From: $from To: $mailto Subject: $subject MIME-Version: 1.0 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit $mailbody _MAIL_ open(MAIL,"| $sendmail -t -i -nj") or die("Can not open $sendmail."); print MAIL $mailtext; close(MAIL); print "Your e-mail has been successfully delivered.\n\t$fromaddr -> $mailto\n";