in reply to Mail script is cutting out data.
The two operations you perform in your script, pinging a remote host and sending an email, can and probably should be done from within Perl, using the Net::Ping and MIME::Lite modules. This gives you several advantages:
With that said, consider using something like the following code:
#! /usr/bin/perl use strict ; use warnings ; use MIME::Lite ; use Net::Ping::External qw/ ping / ; # Ping all the IP addresses. my $output = '' ; while ( <DATA> ) { chomp ; next unless $_ ; $output .= "$_: " . ( ping( host => $_ ) ? 'OK' : 'FAILED' ) . "\n +" ; } # Compose & send the email. my $msg = MIME::Lite->new( From => 'somemail@example.com', To => 'yourmail@example.com', Subject => 'Ping Report', Data => $output ) ; $msg->send ; __DATA__ 888.333.333.33 156.343.333.99 888.323.222.223 888.222.222.111
|
|---|