Here's a script I wrote a while since that I call from ksh scripts.
__BEGIN__
#!/usr/bin/perl -w
use Mail::Sender;
use Getopt::Std;
my $sender=new Mail::Sender {
from=>'[EMAIL PROTECTED]',
reply=>'[EMAIL PROTECTED]',
fake_from=>'RingwaysDMS<[EMAIL PROTECTED]>'};
my %opts=();
getopts('t:f:s:m:',\%opts);
print "t=$opts{t}\n" if $opts{t};
print "f=$opts{f}\n" if $opts{f};
print "s=$opts{s}\n" if $opts{s};
print "m=$opts{m}\n" if $opts{m};
die "Recipient not specified" unless $opts{t};
die "Subject not specified" unless $opts{s};
if ( $opts{f} ) {
die "File not found" unless ( -f $opts{f} );
}
if ( $opts{m} ) {
die "Message file not found" unless ( -f $opts{m} );
}
my $msg='';
if ( $opts{m}) {
open(FIN,"$opts{m}") || die "cannot open message file: $!\n";
} else {
open(FIN,"<&STDIN") || die "cannot open message file: $!\n";
}
while (<FIN>) {
chomp;
$msg.="$_\r\n";
}
close(FIN);
if ( $opts{f} ) {
$sender->MailFile({to=>$opts{t},
subject=>$opts{s},
file=>$opts{f},
msg=>$msg}) ||
die "mailer failed: $Mail::Sender::Error\n";
} else {
$sender->MailMsg({to=>$opts{t},
subject=>$opts{s},
msg=>$msg}) ||
die "mailer failed:$Mail::Sender::Error\n";
}
__END__
On Friday 11 May 2001 4:00 pm, [EMAIL PROTECTED] wrote:
> All,
> I am looking for a way to send the output of a logfile using
> Mail::Sendmail. Is that possible? If so can some body give me a high
> level syntax.
>
> Thanks in advance,
> Kailash
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000