epcim
10/20/2015 - 1:50 PM

ITM email howto

ITM email howto

#!/usr/bin/perl

# Send emails via this platform independent module
# Usage: $0 "email addr" "subject" "body with numbers &{NT_Logical_Disk.Server_Name}"

use Mail::Sendmail;

main();

sub main {
my ($to, $subject, $message) = @ARGV;
send_email($to, $subject, $message);
}

# Sends email using Mail::Sendmail module
sub send_email {
my ($to, $subject, $message) = @_;
my ($mailhost, $from, %mail, @to);

$mailhost = "smtp.mydomain.com";
$from = "itm_alerts\@mydomain.com";

%mail = (
Smtp => $mailhost,
From => $from,
To => $to,
Subject => $subject,
Message => $message,
);
sendmail(%mail);
}