| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::Exchange::Recipient; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Mail::Exchange::Recipient - class to handle message recipients |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Mail::Exchange::Recipient; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $recipient=Mail::Exchange::Recipient->new(); |
|
12
|
|
|
|
|
|
|
$recipient->setEmailAddress('gbl@bso2001.com'); |
|
13
|
|
|
|
|
|
|
$recipient->setDisplayName('Guntram Blohm '); |
|
14
|
|
|
|
|
|
|
$message->addRecipient($recipient); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
A Mail::Exchange::Recipient object reflects the data that |
|
19
|
|
|
|
|
|
|
Mail::Exchange::Recipient uses to add a recipient to a message. Since |
|
20
|
|
|
|
|
|
|
a message has only one sender, but possibly multiple recipients, |
|
21
|
|
|
|
|
|
|
the recipient data isn't stored in message properties (like sender data is), |
|
22
|
|
|
|
|
|
|
instead, a message has zero or more recipient objects attached. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
5
|
|
|
5
|
|
29
|
use strict; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
179
|
|
|
27
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
148
|
|
|
28
|
5
|
|
|
5
|
|
107
|
use 5.008; |
|
|
5
|
|
|
|
|
19
|
|
|
|
5
|
|
|
|
|
179
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
5
|
|
|
5
|
|
28
|
use Exporter; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
173
|
|
|
31
|
5
|
|
|
5
|
|
30
|
use Encode; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
450
|
|
|
32
|
5
|
|
|
5
|
|
33
|
use Mail::Exchange::PidTagDefs; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
527
|
|
|
33
|
5
|
|
|
5
|
|
31
|
use Mail::Exchange::PidTagIDs; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
16583
|
|
|
34
|
5
|
|
|
5
|
|
3360
|
use Mail::Exchange::ObjectTypes; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
372
|
|
|
35
|
5
|
|
|
5
|
|
31
|
use Mail::Exchange::PropertyContainer; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
189
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
5
|
|
|
5
|
|
27
|
use vars qw($VERSION @ISA); |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
3380
|
|
|
38
|
|
|
|
|
|
|
@ISA=qw(Mail::Exchange::PropertyContainer Exporter); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$VERSION = "0.04"; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new() |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$msg=Mail::Exchange::Recipient->new() |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Create a recipient object. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub new { |
|
51
|
1
|
|
|
1
|
1
|
19
|
my $class=shift; |
|
52
|
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
12
|
my $self=Mail::Exchange::PropertyContainer->new(); |
|
54
|
1
|
|
|
|
|
16
|
bless($self, $class); |
|
55
|
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
7
|
$self->set(PidTagRowid, 1); |
|
57
|
1
|
|
|
|
|
5
|
$self->set(PidTagRecipientType, 1); |
|
58
|
1
|
|
|
|
|
7
|
$self->set(PidTagDisplayType, 0); |
|
59
|
1
|
|
|
|
|
5
|
$self->set(PidTagObjectType, otMailUser); |
|
60
|
1
|
|
|
|
|
5
|
$self->set(PidTagAddressType, "SMTP"); |
|
61
|
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
4
|
$self; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 setRecipientType() |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$recipient->setRecipientType(type) |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Sets the type of recipient, which can be 1 for "To", 2 for "CC", |
|
70
|
|
|
|
|
|
|
or 3 for "BCC". For convenience, the strings "to", "cc" and "bcc", |
|
71
|
|
|
|
|
|
|
case-insensitive, are recognized as well. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub setRecipientType { |
|
76
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
77
|
0
|
|
|
|
|
0
|
my $field=shift; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
my $type=0; |
|
80
|
0
|
0
|
|
|
|
0
|
if (uc $field eq "TO") { $type=1; } |
|
|
0
|
|
|
|
|
0
|
|
|
81
|
0
|
0
|
|
|
|
0
|
if (uc $field eq "CC") { $type=2; } |
|
|
0
|
|
|
|
|
0
|
|
|
82
|
0
|
0
|
|
|
|
0
|
if (uc $field eq "BCC") { $type=3; } |
|
|
0
|
|
|
|
|
0
|
|
|
83
|
0
|
0
|
|
|
|
0
|
if ($field =~ /^[0-9]+$/) { $type=$field; } |
|
|
0
|
|
|
|
|
0
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
0
|
die "unknown Recipient Type $field" if ($type==0); |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
0
|
$self->set(PidTagRecipientType, $type); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 setAddressType() |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
$recipient->setRecipientType(type) |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Sets the address type of the recipient, which is "SMTP" normally, |
|
95
|
|
|
|
|
|
|
but may have different values as well depending on transmission type. For |
|
96
|
|
|
|
|
|
|
example, the Microsoft Exchange server uses "EX". |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub setAddressType { |
|
101
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
102
|
0
|
|
|
|
|
0
|
my $type=shift; |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
0
|
$self->set(PidTagAddressType, $type); |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 setDisplayName() |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
$recipient->setDisplayName(name) |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Sets the display name of the recipient. This may be something like |
|
112
|
|
|
|
|
|
|
"Guntram Blohm " for SMTP recipients, |
|
113
|
|
|
|
|
|
|
or just "Blohm, Guntram" for transport within an Exchange Domain. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub setDisplayName { |
|
118
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
119
|
0
|
|
|
|
|
0
|
my $name=shift; |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
$self->set(PidTagDisplayName, $name); |
|
122
|
0
|
|
|
|
|
0
|
$self->set(PidTagTransmittableDisplayName, $name); |
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 setSMTPAddress() |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$recipient->setSMTPAddress(name) |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Sets the SMTP Address of the recipient. This should be an SMTP |
|
130
|
|
|
|
|
|
|
address, even if the address type is not SMTP. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub setSMTPAddress { |
|
135
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
136
|
0
|
|
|
|
|
0
|
my $recipient=shift; |
|
137
|
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
0
|
$self->set(PidTagSmtpAddress, $recipient); |
|
139
|
|
|
|
|
|
|
} |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 setEmailAddress() |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
$recipient->setEmailAddress(name) |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Sets the Email Address of the recipient. This can be an SMTP |
|
146
|
|
|
|
|
|
|
address, if the address type is SMTP, or a differently formatted address, |
|
147
|
|
|
|
|
|
|
if you're using a different Address Type. This sets the SMTP Address as |
|
148
|
|
|
|
|
|
|
well, so if you're using this method for non-SMTP-Adresses, you should |
|
149
|
|
|
|
|
|
|
call setSMTPAddress afterwards. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub setEmailAddress { |
|
154
|
0
|
|
|
0
|
1
|
0
|
my $self=shift; |
|
155
|
0
|
|
|
|
|
0
|
my $recipient=shift; |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
0
|
$self->set(PidTagSmtpAddress, $recipient); |
|
158
|
0
|
|
|
|
|
0
|
$self->set(PidTagEmailAddress, $recipient); |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub OleContainer { |
|
162
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
|
163
|
0
|
|
|
|
|
0
|
my $no=shift; |
|
164
|
0
|
|
|
|
|
0
|
my $unicode=shift; |
|
165
|
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
0
|
my $header=pack("V2", 0, 0); |
|
167
|
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
$self->set(PidTagRowid, $no); |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
0
|
my @streams=$self->_OlePropertyStreamlist($unicode, $header); |
|
171
|
0
|
|
|
|
|
0
|
my $dirname=Encode::encode("UCS2LE", sprintf("__recip_version1.0_#%08X", $no)); |
|
172
|
0
|
|
|
|
|
0
|
my @ltime=localtime(); |
|
173
|
0
|
|
|
|
|
0
|
my $dir=OLE::Storage_Lite::PPS::Dir->new($dirname, \@ltime, \@ltime, \@streams); |
|
174
|
0
|
|
|
|
|
0
|
return $dir; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub _parseRecipientProperties { |
|
178
|
1
|
|
|
1
|
|
2
|
my $self=shift; |
|
179
|
1
|
|
|
|
|
2
|
my $file=shift; |
|
180
|
1
|
|
|
|
|
2
|
my $dir=shift; |
|
181
|
1
|
|
|
|
|
2
|
my $namedProperties=shift; |
|
182
|
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
10
|
$self->_parseProperties($file, $dir, 8, $namedProperties); |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
1; |