sub sendEmail { my ($to, $from, $subject, $message) = @_; my $sendmail = '/usr/lib/sendmail'; open(MAIL, "|$sendmail -oi -t"); print MAIL "From: $from\n"; print MAIL "To: $to\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$message\n"; close(MAIL); } sendEmail("receiveremail\@domain.com", "myemail\@domain.com", "Nagios Error", "Cannot receive NRPE output from host 10.100.5.6");
Reference :
[1] Pastebin GarciaPL Send email in Perl
No comments:
Post a Comment