#!/perl/bin/perl -w

use Mail::Sender;

# Configure your SMTP server
my $smtp = 'servername';
# Configure your recipient
my $to   = 'admin\@yourcomp.com';
# Configure your sender
my $from = '"Password check log" <helpdesk\@comp.com>';
# Configure the file to attach
my $file = 'sys:/system/abend.log';
# Configure the subject of the mail
my $subj = 'your subject';
# Configure the message body of the mail
my $msg  = "Your message\nFile: $file\n";

# ********** nothing to configure below **********

# print "Mail::Sender::VERSION = $Mail::Sender::VERSION\n";
if (!-e $file) {
     print "Error: $file not found!\n";
     exit;
}
$sender = new Mail::Sender{smtp => $smtp, from => "\"Service Auto Mailer\" <$from>"};
if ($sender->MailFile({to => $to, subject => $subj, msg => $msg, file => $file})) {
  print "\r$0: Mail sent OK.\n";
} else {
  print "\rError sending mail!\n";
}
exit;



