line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Smoke::Mailer::Mail_Sendmail; |
2
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
81
|
|
3
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
113
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.016'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
14
|
use base 'Test::Smoke::Mailer::Base'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
979
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 Test::Smoke::Mailer::Mail_Sendmail |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
This handles sending the message using the B 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 sets up the message to be send by B. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub mail { |
35
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
eval { require Mail::Sendmail; }; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$self->{error} = $@ and return undef; |
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
|
0
|
|
|
|
|
$message{cc} = $cc if $cc; |
50
|
0
|
0
|
|
|
|
|
$message{bcc} = $self->{bcc} if $self->{bcc}; |
51
|
0
|
0
|
|
|
|
|
$message{from} = $self->{from} if $self->{from}; |
52
|
0
|
0
|
|
|
|
|
$message{smtp} = $self->{mserver} if $self->{mserver}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$message{ 'Content-type' } = qq!text/plain; charset="UTF8"! |
55
|
0
|
0
|
0
|
|
|
|
if exists $ENV{LANG} && $ENV{LANG} =~ /utf-?8$/i; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
$self->{v} > 1 and print "[Mail::Sendmail]\n"; |
58
|
0
|
0
|
|
|
|
|
$self->{v} and print "Sending report to $self->{to} "; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Mail::Sendmail::sendmail( %message ) or |
61
|
0
|
0
|
|
|
|
|
$self->{error} = $Mail::Sendmail::error; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
$self->{v} and print $self->{error} ? "not OK\n" : "OK\n"; |
|
|
0
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return ! $self->{error}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
(c) 2002-2013, All rights reserved. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
* Abe Timmerman |
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
|
|
|
|
|
|
|
* , |
82
|
|
|
|
|
|
|
* |
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 |