syslog-email.pl 288 B

1234567891011121314151617181920
  1. #!/usr/bin/perl -n
  2. # thanks to Brian Dowling for an example with security in mind.
  3. $TO = 'user@company.com';
  4. $FROM = 'user@company.com';
  5. s/^<\d{1,2}>//;
  6. open(MAIL, "|/usr/sbin/sendmail -t");
  7. print MAIL <<"EOT";
  8. To: $TO
  9. From: $FROM
  10. Subject: Uplink Went Down: $_
  11. $_
  12. EOT
  13. close(MAIL);