| 1 | package Log::Dispatch::Email::MailSendmail; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | our $VERSION = '2.71'; | ||
| 7 | |||
| 8 | 0 | ▶ | use Mail::Sendmail (); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | use base qw( Log::Dispatch::Email ); | ||
| 11 | |||
| 12 | sub send_email { | ||
| 13 | my $self = shift; | ||
| 14 | my %p = @_; | ||
| 15 | |||
| 16 | my %mail = ( | ||
| 17 | To => ( join ',', @{ $self->{to} } ), | ||
| 18 | Subject => $self->{subject}, | ||
| 19 | Message => $p{message}, | ||
| 20 | |||
| 21 | # Mail::Sendmail insists on having this parameter. | ||
| 22 | From => $self->{from} || 'LogDispatch@foo.bar', | ||
| 23 | ); | ||
| 24 | |||
| 25 | local $? = 0; | ||
| 26 | unless ( Mail::Sendmail::sendmail(%mail) ) { | ||
| 27 | warn "Error sending mail: $Mail::Sendmail::error"; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | 1; | ||
| 32 | |||
| 33 | # ABSTRACT: Subclass of Log::Dispatch::Email that uses the Mail::Sendmail module | ||
| 34 | |||
| 35 | __END__ | ||