| 1 | package Test::Smoke::Mailer::Mail_Sendmail; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 3 | our $VERSION = '0.016'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use base 'Test::Smoke::Mailer::Base'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 Test::Smoke::Mailer::Mail_Sendmail | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | This handles sending the message using the B<Mail::Sendmail> module. | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | =head2 Test::Smoke::Mailer::Mail_Sendmail->new( %args ) | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | Keys for C<%args>: | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | * ddir | ||||||||||||||||||||||||||||
| 20 | * mserver | ||||||||||||||||||||||||||||
| 21 | * to | ||||||||||||||||||||||||||||
| 22 | * from | ||||||||||||||||||||||||||||
| 23 | * cc | ||||||||||||||||||||||||||||
| 24 | * v | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head2 $mailer->mail( ) | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | C<mail()> sets up the message to be send by B<Mail::Sendmail>. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =cut | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub mail { | ||||||||||||||||||||||||||
|
Subroutine
mail: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | eval { require Mail::Sendmail; }; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $self->{error} = $@ and return undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | my $subject = $self->fetch_report(); | |||||||||||||||||||||||||||
| 42 | 0 | my $cc = $self->_get_cc( $subject ); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | my %message = ( | ||||||||||||||||||||||||||||
| 45 | To => $self->{to}, | ||||||||||||||||||||||||||||
| 46 | Subject => $subject, | ||||||||||||||||||||||||||||
| 47 | Body => $self->{body}, | ||||||||||||||||||||||||||||
| 48 | 0 | ); | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | $message{cc} = $cc if $cc; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | $message{bcc} = $self->{bcc} if $self->{bcc}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | $message{from} = $self->{from} if $self->{from}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $message{smtp} = $self->{mserver} if $self->{mserver}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | $message{ 'Content-type' } = qq!text/plain; charset="UTF8"! | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if exists $ENV{LANG} && $ENV{LANG} =~ /utf-?8$/i; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $ENV{"LANG"} and $ENV{"LANG"} =~ /utf-?8$/i
MC/DC0%0/2
exists $ENV{"LANG"} and $ENV{"LANG"} =~ /utf-?8$/i
exists $ENV{"LANG"}
$ENV{"LANG"} =~ /utf-?8$/i
Truth table0%0/3
A and B
A= exists $ENV{"LANG"}B= $ENV{"LANG"} =~ /utf-?8$/i
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $self->{v} > 1 and print "[Mail::Sendmail]\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $self->{v} and print "Sending report to $self->{to} "; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | Mail::Sendmail::sendmail( %message ) or | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | $self->{error} = $Mail::Sendmail::error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $self->{v} and print $self->{error} ? "not OK\n" : "OK\n"; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | return ! $self->{error}; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 3 | 1; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | (c) 2002-2013, All rights reserved. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | * Abe Timmerman <abeltje@cpan.org> | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 77 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | See: | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | * <http://www.perl.com/perl/misc/Artistic.html>, | ||||||||||||||||||||||||||||
| 82 | * <http://www.gnu.org/copyleft/gpl.html> | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 85 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =cut | ||||||||||||||||||||||||||||