- livedoor blog からひっこそうかしら。
あうあう
- てすと
auauau
#!/usr/bin/perl # メール送信 # perl mail.pl -from xxxxx@xxxx.com -to sender@xxxx.net -cc xxx@xxxxx.ne.jp -cc xxx@xxxxx.co.jp use Net::SMTP; use Getopt::Long; GetOptions('from=s'=>$from,'to=s'=>$to,'cc=s'=>@cc,'subject=s'=>$subject); if ($from eq '' || $to eq '' ) { print "Error: from= $from to:$to"; die 'Usage: perl mail.pl -from xxxxx@xxxx.com -to sender@xxxx.net -cc xxx@xxxxx.ne.jp -cc xxx@xxxxx.co.jp'."\n"; } $smtp_host = 'smtp.xxxx.jp'; $smtp = Net::SMTP->new($smtp_host, Hello=>'hostname.co.jp' ); $smtp->mail($from); $smtp->to($to); $smtp->data(); $smtp->datasend("From:$from\n"); $smtp->datasend("To:$to\n"); foreach $c (@cc) { $smtp->datasend("CC:$c\n"); } $smtp->datasend("Subject:$subject\n"); $smtp->datasend('Content-Type: text/plain'."\n"); while (<STDIN>) { $smtp->datasend($_); } $smtp->quit; print "done.\n";
とてつもなく便利だ。。。。