line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::SMTP::IPMM; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27228
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Net::SMTP'; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
1130
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# import CMD_* constants |
9
|
1
|
|
|
1
|
|
90231
|
use Net::Cmd; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
627
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub ackrcpt { |
14
|
0
|
|
|
0
|
1
|
|
my ( $self, $command ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# object is a globref |
17
|
0
|
0
|
|
|
|
|
${ *$self }{ipmm_ackrcpt} = $command ? 1 : 0; |
|
0
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
$self->_ACKRCPT( $command ? 'on' : 'off' ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub xmrg { |
23
|
0
|
|
|
0
|
1
|
|
my ( $self, $address ) = @_; |
24
|
0
|
|
|
|
|
|
my $sender = $self->_addr( $address ); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
$self->_XMRG( $sender ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub xdfn { |
30
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
my %args = @_; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $command = '*PARTS="' . delete( $args{ 'PARTS' } ) . '"'; |
34
|
0
|
|
|
|
|
|
while ( my ( $key, $value ) = each %args ) { |
35
|
0
|
|
|
|
|
|
$command .= " $key=\"$value\""; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$self->_XDFN( $command ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub xprt { |
42
|
0
|
|
|
0
|
1
|
|
my ( $self, @parts ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $count = @parts; |
45
|
0
|
|
|
|
|
|
my $i = 1; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
foreach my $part( @parts ) { |
48
|
0
|
|
|
|
|
|
my $command = $i; |
49
|
0
|
0
|
|
|
|
|
$command .= ' LAST' if $i == $count; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
$self->_XPRT( $command ) or return; |
52
|
0
|
0
|
|
|
|
|
$self->datasend( $part ) or return; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$i++; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$self->dataend; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# _addr isn't in our contract, so we define it since it may change |
61
|
|
|
|
|
|
|
# between releases. For example, see the difference between Net::SMTP |
62
|
|
|
|
|
|
|
# 2.24 and 2.26. |
63
|
|
|
|
|
|
|
sub _addr { |
64
|
0
|
|
|
0
|
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
my $addr = shift; |
66
|
0
|
0
|
|
|
|
|
$addr = "" unless defined $addr; |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if ( ${ *$self }{net_smtp_exact_addr} ) { |
|
0
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
return $1 if $addr =~ /^\s*(<.*>)\s*$/s; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
0
|
0
|
|
|
|
|
return $1 if $addr =~ /(<[^>]*>)/; |
73
|
0
|
|
|
|
|
|
$addr =~ s/^\s+|\s+$//sg; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
"<$addr>"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
|
|
sub _ACKRCPT { shift->command( "XLSMTP-ACKRCPT", @_ )->response == CMD_OK } |
80
|
0
|
|
|
0
|
|
|
sub _XMRG { shift->command( "XMRG FROM:" , @_ )->response == CMD_OK } |
81
|
0
|
|
|
0
|
|
|
sub _XDFN { shift->command( "XDFN", @_ )->response == CMD_OK } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# XPRT returns OK on the first part and MORE on subsequent parts |
84
|
|
|
|
|
|
|
# for no reason that I can figure out. |
85
|
|
|
|
|
|
|
sub _XPRT { |
86
|
0
|
|
|
0
|
|
|
my $r = shift->command( "XPRT", @_ )->response; |
87
|
0
|
0
|
0
|
|
|
|
return 1 if ( $r == CMD_OK ) or ( $r == CMD_MORE ); |
88
|
0
|
|
|
|
|
|
return; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _RCPT { |
93
|
0
|
|
|
0
|
|
|
my $self = shift; |
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
if( ${ *$self }{ipmm_ackrcpt} ) { |
|
0
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return $self->command( "RCPT", @_ )->response == CMD_OK; |
97
|
|
|
|
|
|
|
} else { |
98
|
0
|
|
|
|
|
|
return $self->command( "RCPT", @_ ); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
return undef; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |