| 1 | package Log::Dispatch::Email::MIMELite; | ||
| 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 MIME::Lite; |
|
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 | Type => 'TEXT', | ||
| 20 | Data => $p{message}, | ||
| 21 | ); | ||
| 22 | |||
| 23 | $mail{From} = $self->{from} if defined $self->{from}; | ||
| 24 | |||
| 25 | local $? = 0; | ||
| 26 | unless ( MIME::Lite->new(%mail)->send ) { | ||
| 27 | warn 'Error sending mail with MIME::Lite'; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | 1; | ||
| 32 | |||
| 33 | # ABSTRACT: Subclass of Log::Dispatch::Email that uses the MIME::Lite module | ||
| 34 | |||
| 35 | __END__ | ||