in reply to Re: can't get mailx to send from within a script
in thread can't get mailx to send from within a script

Gellyfish,

not sure why the other suggestions didn't work, but yours did so that's what I went with.

As it happens I needed to email the contents of a file and found this to work :

$file="/tmp/output.txt";

my $text = do { local( @ARGV, $/ ) = $file ; <> } ;

open MAILX,'|/bin/mailx -s "Output" John@work.com' or die $!;

print MAILX $text;

close MAILX or die "mailx: $! $?";

many thanks to all who contributed, Ad

  • Comment on Re^2: can't get mailx to send from within a script