perl(Net::SMTP)でmail送信/添付ファイルあり

#!/usr/bin/perl

use Net::SMTP;
use MIME::Entity;

# Settings

our $SENDER    = "kotaka\@yourdomain.co.jp";
our $RECIPIENT  = "kotaka\@yourdomain.co.jp";
our $smtp_srv   = "192.168.1.254";
our $smtp_domain = "yourdomain.co.jp";
our $SUBJECT   = "backup mails / バックアップです " ;#件名を指定

our $ATTACHED_FILE_1 = 'C:/work2/Perl/mail/test1.txt';
our $ATTACHED_FILE_2 = 'C:/work2/Perl/mail/test2.txt';

# Create object
my $smtp=Net::SMTP->new($smtp_srv, HELLO=>$smtp_domain);

# Built headers
$smtp->mail($SENDER);         # Sender
$smtp->to ($RECIPIENT);       # Receiver

# Built Data (Create data by MIME::Entity)
$smtp->data();
my $mime = MIME::Entity->build(
      From  =>  $SENDER  , # Sender  (data)
      To   =>  $RECIPIENT, # Receiver (data)
      Subject =>  $SUBJECT , # Subject
      Type   => 'text/plain;charset="iso-2022-jp"', #後ろのcharsetがミソ
      Data  => ["バックアップです\n","以上\n"],#必ず1文字以上指定
      Encoding => "7bit" 
      );     # body

# Attached files
#    Type   => 'image/jpeg',
#    Encoding => 'Base64'

# Attached file
$mime->attach(
    Path   => $ATTACHED_FILE_1,
    Type   => 'text/plain',
    Encoding => '-SUGGEST'
);

# Attached file

$mime->attach(
    Path   => $ATTACHED_FILE_2,
    Type   => 'text/plain',
    Encoding => '-SUGGEST'
);


$smtp->datasend($mime->stringify); # transfer strings

# Data termination and send mail
$smtp->dataend();

#Quit SMTP connection
$smtp->quit;

# for debug
#print "Sender  : $SENDER\n";
#print "Recipient : $RECIPIENT\n";
#print "Attached : $ATTACHED_FILE_1\n";
#print "Attached : $ATTACHED_FILE_2\n";
print "completed . \n";

1;

# 参考----------------------------------------------------------
# http://homepage3.nifty.com/hippo2000/perltips/perlmail.htm#1.4