1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Mediapart Selligent Client API |
5
|
|
|
* |
6
|
|
|
* CC BY-NC-SA <https://github.com/mediapart/selligent> |
7
|
|
|
* |
8
|
|
|
* For the full license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Mediapart\Selligent\Broadcast; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* |
16
|
|
|
*/ |
17
|
|
|
class Email |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var string The name as defined for the email message properties. |
21
|
|
|
*/ |
22
|
|
|
private $name; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var integer The ID of the folder in which the email is stored. |
26
|
|
|
*/ |
27
|
|
|
private $folderId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var integer The Brand used for sending out the email message. |
31
|
|
|
*/ |
32
|
|
|
private $mailDomainId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var boolean This indicates if the list unsubscribe option has been activated for the email message. |
36
|
|
|
*/ |
37
|
|
|
private $unsubscribe; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var integer The queue to which the email messages are transferred for broadcast. |
41
|
|
|
*/ |
42
|
|
|
private $queueId; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
private $tag; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string The category attributed to the email message. |
51
|
|
|
*/ |
52
|
|
|
private $maCategory; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var Target |
56
|
|
|
*/ |
57
|
|
|
private $target; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var array |
61
|
|
|
*/ |
62
|
|
|
private $content = []; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var boolean |
66
|
|
|
*/ |
67
|
|
|
protected $hyperlinks_to_sensors = false; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @param string $name The name as defined for the email message properties. |
71
|
|
|
* @return self |
72
|
|
|
*/ |
73
|
1 |
|
public function setName($name) |
74
|
|
|
{ |
75
|
1 |
|
$this->name = $name; |
76
|
|
|
|
77
|
1 |
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return string The name as defined for the email message properties. |
82
|
|
|
*/ |
83
|
2 |
|
public function getName() |
84
|
|
|
{ |
85
|
2 |
|
return $this->name; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param integer $folderId The ID of the folder in which the email is stored |
90
|
|
|
* @return self |
91
|
|
|
*/ |
92
|
1 |
|
public function setFolderId($folderId) |
93
|
|
|
{ |
94
|
1 |
|
$this->folderId = $folderId; |
95
|
|
|
|
96
|
1 |
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return integer The ID of the folder in which the email is stored |
101
|
|
|
*/ |
102
|
2 |
|
public function getFolderId() |
103
|
|
|
{ |
104
|
2 |
|
return $this->folderId; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param boolean This indicates if the list unsubscribe option has been activated for the email message. |
109
|
|
|
* @return self |
110
|
|
|
*/ |
111
|
1 |
|
public function listUnsubscribe($unsubscribe = true) |
112
|
|
|
{ |
113
|
1 |
|
$this->unsubscribe = $unsubscribe; |
114
|
|
|
|
115
|
1 |
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return boolean Indicates if the list unsubscribe option has been activated for the email message. |
120
|
|
|
*/ |
121
|
2 |
|
public function canUnsubscribe() |
122
|
|
|
{ |
123
|
2 |
|
return $this->unsubscribe; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param integer The queue to which the email messages are transferred for broadcast. |
128
|
|
|
* @return self |
129
|
|
|
*/ |
130
|
1 |
|
public function setQueueId($queueId) |
131
|
|
|
{ |
132
|
1 |
|
$this->queueId = $queueId; |
133
|
|
|
|
134
|
1 |
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return integer The queue to which the email messages are transferred for broadcast. |
139
|
|
|
*/ |
140
|
2 |
|
public function getQueueId() |
141
|
|
|
{ |
142
|
2 |
|
return $this->queueId; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param integer The Brand used for sending out the email message. |
147
|
|
|
* @return self |
148
|
|
|
*/ |
149
|
1 |
|
public function setMailDomainId($mailDomainId) |
150
|
|
|
{ |
151
|
1 |
|
$this->mailDomainId = $mailDomainId; |
152
|
|
|
|
153
|
1 |
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return integer The Brand used for sending out the email message. |
158
|
|
|
*/ |
159
|
2 |
|
public function getMailDomainId() |
160
|
|
|
{ |
161
|
2 |
|
return $this->mailDomainId; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @param string $tag |
166
|
|
|
* @return self |
167
|
|
|
*/ |
168
|
1 |
|
public function setTag($tag) |
169
|
|
|
{ |
170
|
1 |
|
$this->tag = $tag; |
171
|
|
|
|
172
|
1 |
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return string |
177
|
|
|
*/ |
178
|
2 |
|
public function getTag() |
179
|
|
|
{ |
180
|
2 |
|
return $this->tag; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @param string The category attributed to the email message. |
185
|
|
|
* @return self |
186
|
|
|
*/ |
187
|
1 |
|
public function setMaCategory($maCategory) |
188
|
|
|
{ |
189
|
1 |
|
$this->maCategory = $maCategory; |
190
|
|
|
|
191
|
1 |
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return string |
196
|
|
|
*/ |
197
|
2 |
|
public function getMaCategory() |
198
|
|
|
{ |
199
|
2 |
|
return $this->maCategory; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param Target $target |
204
|
|
|
* @return self |
205
|
|
|
*/ |
206
|
2 |
|
public function setTarget($target) |
207
|
|
|
{ |
208
|
2 |
|
$this->target = $target; |
209
|
|
|
|
210
|
2 |
|
return $this; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* @return Target |
215
|
|
|
*/ |
216
|
2 |
|
public function getTarget() |
217
|
|
|
{ |
218
|
2 |
|
return $this->target; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* |
223
|
|
|
* With the folling key/values : |
224
|
|
|
* |
225
|
|
|
* - HTML: The complete HTML version of the email message |
226
|
|
|
* - TEXT: The complete text version of the email message |
227
|
|
|
* - FROM_ADDR: The From address used for the email |
228
|
|
|
* - FROM_NAME: The From name used in the email |
229
|
|
|
* - TO_ADDR: The recipients email address. This is always like following: ~Mail~ |
230
|
|
|
* - TO_NAME: The recipient’s name. This is always like following: ~Name~ |
231
|
|
|
* - REPLY_ADDR: The ‘reply to’ address |
232
|
|
|
* - REPLY_NAME: The ‘reply to’ name |
233
|
|
|
* - SUBJECT: The subject line of the email message |
234
|
|
|
* |
235
|
|
|
* @param Array |
236
|
|
|
* @return self |
237
|
|
|
*/ |
238
|
1 |
|
public function setContent($content) |
239
|
|
|
{ |
240
|
1 |
|
$this->content = $content; |
241
|
|
|
|
242
|
1 |
|
return $this; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return Array |
247
|
|
|
*/ |
248
|
2 |
|
public function getContent() |
249
|
|
|
{ |
250
|
2 |
|
return $this->content; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* Set this value to TRUE when your hyperlinks must be converted to sensors. |
255
|
|
|
* |
256
|
|
|
* @param boolean $hyperlinks_to_sensors |
257
|
|
|
* @return self |
258
|
|
|
*/ |
259
|
2 |
|
public function setHyperlinksToSensors($hyperlinks_to_sensors = true) |
260
|
|
|
{ |
261
|
2 |
|
$this->hyperlinks_to_sensors = $hyperlinks_to_sensors; |
262
|
|
|
|
263
|
2 |
|
return $this; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* @return boolean |
268
|
|
|
*/ |
269
|
3 |
|
public function hasHyperlinksToSensors() |
270
|
|
|
{ |
271
|
3 |
|
return $this->hyperlinks_to_sensors; |
272
|
|
|
} |
273
|
|
|
} |
274
|
|
|
|