#!/usr/bin/perl -w $from = 'email@123.org'; $to = 'email@456.org'; $servername = 'email.789.org'; # $user ='username'; # $pwd ='password'; open RECCHK, "/tmp/statusmon.eml"; @recchkvar = ; use Sys::Hostname; my $host = hostname(); my $host1 = uc($host); open STDERR, '>&STDOUT'; #redirect STDERR output to STDOUT use Net::SMTP; $smtp = Net::SMTP->new("$servername", Debug => 1); ### Enable below if authentication required and set parameters above # $smtp->datasend("AUTH LOGIN\n"); # $smtp->datasend("$user\n"); # $smtp->datasend("$pwd\n"); sleep(2); $smtp->mail("$from"); $smtp->to("$to"); $smtp->data; $smtp->datasend("Subject: 79XX/69XXC/WB3 InfiniStream $host1 has an issue, and requires investigation \n"); foreach $line (@recchkvar) { $smtp->datasend("$line\n"); } close RECCHK; $smtp->dataend; $smtp->quit