in reply to Using system with mailx
Nevertheless let me forge on with a suggested change in your strategy:
#!/usr/bin/perl -w use strict; use diagnostics; use warnings; open(FIN,"< /opt/autotree/autouser/out/chk_cal_date.out") or die $!; my $old_ifs=$/; # Lets nullify the IRS. $/=undef; my $slurp=<FIN>; $/=$old_ifs; # Restore the IFS close FIN; send_the_mail('you@there.com','a subject',$slurp); exit(0); sub send_the_mail { my($addr,$subject,$body)=@_; open(PIPE,sprintf("| mailx -s %s %s",$subject,$addr)) or die $!; print <PIPE> $body; close PIPE; } __END__
Hope this helps.
Peter @ Berghold . Net
Sieze the cow! Bite the day!
Test the code? We don't need to test no stinkin' code! All code posted here is as is where is unless otherwise stated.
Brewer of Belgian style Ales
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using system with mailx
by cutter (Acolyte) on Aug 06, 2003 at 14:42 UTC | |
by Abigail-II (Bishop) on Aug 06, 2003 at 14:57 UTC | |
|
Re: Re: Using system with mailx
by Anonymous Monk on Aug 06, 2003 at 15:16 UTC | |
by Anonymous Monk on Aug 06, 2003 at 15:22 UTC | |
by blue_cowdawg (Monsignor) on Aug 06, 2003 at 15:27 UTC |