| 1 | package Email::Send::SMTP::TLS; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use vars qw[$VERSION]; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Email::Address; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use Net::SMTP::TLS::ButMaintained; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use Return::Value; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 1 | $VERSION = '0.04'; | |||||||||||
| 11 | |||||||||||||
| 12 | 0 | ▶ | sub is_available { | ||||||||||
|
Subroutine
is_available: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 13 | 0 | return 1; | |||||||||||
| 14 | } | ||||||||||||
| 15 | |||||||||||||
| 16 | 0 | ▶ | sub get_env_sender { | ||||||||||
|
Subroutine
get_env_sender: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 17 | 0 | my ( $class, $message ) = @_; | |||||||||||
| 18 | |||||||||||||
| 19 | 0 | my $from | |||||||||||
| 20 | = ( Email::Address->parse( $message->header('From') ) )[0]->address; | ||||||||||||
| 21 | } | ||||||||||||
| 22 | |||||||||||||
| 23 | 0 | ▶ | sub get_env_recipients { | ||||||||||
|
Subroutine
get_env_recipients: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 24 | 0 | my ( $class, $message ) = @_; | |||||||||||
| 25 | |||||||||||||
| 26 | 0 | my %to = map { $_->address => 1 } | |||||||||||
| 27 | 0 | map { Email::Address->parse( $message->header($_) ) } qw(To Cc Bcc); | |||||||||||
| 28 | |||||||||||||
| 29 | 0 | return keys %to; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 0 | ▶ | sub send { | ||||||||||
|
Subroutine
send: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 33 | 0 | my ($class, $message, @args) = @_; | |||||||||||
| 34 | |||||||||||||
| 35 | 0 | my %args; | |||||||||||
| 36 | 0 | ▶ | if ( @args % 2 ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 37 | 0 | my $host = shift @args; | |||||||||||
| 38 | 0 | %args = @args; | |||||||||||
| 39 | 0 | $args{Host} = $host; | |||||||||||
| 40 | } else { | ||||||||||||
| 41 | 0 | %args = @args; | |||||||||||
| 42 | } | ||||||||||||
| 43 | |||||||||||||
| 44 | 0 | ▶ | my $host = delete($args{Host}) || 'localhost'; | ||||||||||
|
Condition0%0/2
delete $args{'Host'} || 'localhost'
MC/DC0%0/1
delete $args{'Host'} || 'localhost'
delete $args{'Host'}
Truth table0%0/2
A
A= delete $args{'Host'}
| |||||||||||||
| 45 | 0 | my $SMTP = Net::SMTP::TLS::ButMaintained->new($host, %args); | |||||||||||
| 46 | |||||||||||||
| 47 | 0 | eval { | |||||||||||
| 48 | 0 | my $from = $class->get_env_sender($message); | |||||||||||
| 49 | 0 | $SMTP->mail($from); | |||||||||||
| 50 | |||||||||||||
| 51 | 0 | my @to = $class->get_env_recipients($message); | |||||||||||
| 52 | 0 | $SMTP->to( @to ); | |||||||||||
| 53 | |||||||||||||
| 54 | }; | ||||||||||||
| 55 | 0 | ▶ | return failure $@ if $@; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 56 | |||||||||||||
| 57 | 0 | $SMTP->data(); | |||||||||||
| 58 | 0 | $SMTP->datasend( $message->as_string ); | |||||||||||
| 59 | 0 | $SMTP->dataend; | |||||||||||
| 60 | 0 | $SMTP->quit; | |||||||||||
| 61 | |||||||||||||
| 62 | 0 | return success 1; | |||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | 1 | 1; | |||||||||||
| 66 | __END__ | ||||||||||||