1 | <?php |
||
15 | class EmailConfig extends AbstractConfig |
||
16 | { |
||
17 | use EmailAwareTrait; |
||
18 | |||
19 | /** |
||
20 | * Whether SMTP should be used. |
||
21 | * |
||
22 | * @var boolean $smtp |
||
23 | */ |
||
24 | private $smtp = false; |
||
25 | |||
26 | /** |
||
27 | * The SMTP hostname. |
||
28 | * |
||
29 | * @var string $smtpHostname |
||
30 | */ |
||
31 | private $smtpHostname; |
||
32 | |||
33 | /** |
||
34 | * The SMTP port. |
||
35 | * |
||
36 | * @var integer $smtpPort |
||
37 | */ |
||
38 | private $smtpPort; |
||
39 | |||
40 | /** |
||
41 | * The SMTP security type. |
||
42 | * |
||
43 | * @var string $smtpSecurity |
||
44 | */ |
||
45 | private $smtpSecurity = ''; |
||
46 | |||
47 | /** |
||
48 | * Whether SMTP requires authentication. |
||
49 | * |
||
50 | * @var boolean $smtpAuth |
||
51 | */ |
||
52 | private $smtpAuth; |
||
53 | |||
54 | /** |
||
55 | * The SMTP username. |
||
56 | * |
||
57 | * @var string $smtpUsername |
||
58 | */ |
||
59 | private $smtpUsername; |
||
60 | |||
61 | /** |
||
62 | * The SMTP password. |
||
63 | * |
||
64 | * @var string $smtpPassword |
||
65 | */ |
||
66 | private $smtpPassword; |
||
67 | |||
68 | /** |
||
69 | * The default sender's email address. |
||
70 | * |
||
71 | * @var string $defaultFrom |
||
72 | */ |
||
73 | private $defaultFrom; |
||
74 | |||
75 | /** |
||
76 | * The default "Reply-To" email address. |
||
77 | * |
||
78 | * @var string $defaultReplyTo |
||
79 | */ |
||
80 | private $defaultReplyTo; |
||
81 | |||
82 | /** |
||
83 | * Whether the email (open) should be tracked by default. |
||
84 | * |
||
85 | * @var boolean $defaultTrack |
||
86 | */ |
||
87 | private $defaultTrackOpenEnabled; |
||
88 | |||
89 | |||
90 | /** |
||
91 | * Whether the email (links) should be tracked by default. |
||
92 | * |
||
93 | * @var boolean $defaultTrack |
||
94 | */ |
||
95 | private $defaultTrackLinksEnabled; |
||
96 | |||
97 | /** |
||
98 | * Whether the email should be logged by default. |
||
99 | * |
||
100 | * @var boolean $defaultLog |
||
101 | */ |
||
102 | private $defaultLogEnabled; |
||
103 | |||
104 | /** |
||
105 | * Default email configuration. |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | public function defaults(): array |
||
122 | |||
123 | /** |
||
124 | * Set whether SMTP should be used for sending the email. |
||
125 | * |
||
126 | * @param boolean $smtp If the email should be sent using SMTP or not. |
||
127 | * @throws InvalidArgumentException If the SMTP state is not a boolean. |
||
128 | * @return self |
||
129 | */ |
||
130 | public function setSmtp($smtp) |
||
135 | |||
136 | /** |
||
137 | * Determine if SMTP should be used. |
||
138 | * |
||
139 | * @return boolean |
||
140 | */ |
||
141 | public function smtp() |
||
145 | |||
146 | /** |
||
147 | * Set the SMTP hostname to be used. |
||
148 | * |
||
149 | * @param string $hostname The SMTP hostname. |
||
150 | * @throws InvalidArgumentException If the SMTP hostname is not a string. |
||
151 | * @return self |
||
152 | */ |
||
153 | public function setSmtpHostname($hostname) |
||
165 | |||
166 | /** |
||
167 | * Get the SMTP hostname. |
||
168 | * |
||
169 | * @return string |
||
170 | */ |
||
171 | public function smtpHostname() |
||
175 | |||
176 | /** |
||
177 | * Set the SMTP port to be used. |
||
178 | * |
||
179 | * @param integer $port The SMTP port. |
||
180 | * @throws InvalidArgumentException If the SMTP port is not an integer. |
||
181 | * @return self |
||
182 | */ |
||
183 | public function setSmtpPort($port) |
||
195 | |||
196 | /** |
||
197 | * Get the SMTP port. |
||
198 | * |
||
199 | * @return integer |
||
200 | */ |
||
201 | public function smtpPort() |
||
205 | |||
206 | /** |
||
207 | * Set whether SMTP requires authentication. |
||
208 | * |
||
209 | * @param boolean $auth The SMTP authentication flag (if auth is required). |
||
210 | * @return self |
||
211 | */ |
||
212 | public function setSmtpAuth($auth) |
||
217 | |||
218 | /** |
||
219 | * Determine if SMTP requires authentication. |
||
220 | * |
||
221 | * @return boolean |
||
222 | */ |
||
223 | public function smtpAuth() |
||
227 | |||
228 | /** |
||
229 | * Set the SMTP username to be used. |
||
230 | * |
||
231 | * @param string $username The SMTP username, if using authentication. |
||
232 | * @throws InvalidArgumentException If the SMTP username is not a string. |
||
233 | * @return self |
||
234 | */ |
||
235 | public function setSmtpUsername($username) |
||
247 | |||
248 | /** |
||
249 | * Get the SMTP username. |
||
250 | * |
||
251 | * @return string |
||
252 | */ |
||
253 | public function smtpUsername() |
||
257 | |||
258 | /** |
||
259 | * Set the SMTP password to be used. |
||
260 | * |
||
261 | * @param string $password The SMTP password, if using authentication. |
||
262 | * @throws InvalidArgumentException If the SMTP password is not a string. |
||
263 | * @return self |
||
264 | */ |
||
265 | public function setSmtpPassword($password) |
||
277 | |||
278 | /** |
||
279 | * Get the SMTP password. |
||
280 | * |
||
281 | * @return string |
||
282 | */ |
||
283 | public function smtpPassword() |
||
287 | |||
288 | /** |
||
289 | * Set the SMTP security type to be used. |
||
290 | * |
||
291 | * @param string $security The SMTP security type (empty, "TLS", or "SSL"). |
||
292 | * @throws InvalidArgumentException If the security type is not valid (empty, "TLS", or "SSL"). |
||
293 | * @return self |
||
294 | */ |
||
295 | public function setSmtpSecurity($security) |
||
310 | |||
311 | /** |
||
312 | * Get the SMTP security type. |
||
313 | * |
||
314 | * @return string |
||
315 | */ |
||
316 | public function smtpSecurity() |
||
320 | |||
321 | /** |
||
322 | * Set the default sender's email address. |
||
323 | * |
||
324 | * @param string|array $email The default "From" email address. |
||
325 | * @return self |
||
326 | */ |
||
327 | public function setDefaultFrom($email) |
||
332 | |||
333 | /** |
||
334 | * Get the sender email address. |
||
335 | * |
||
336 | * @return string |
||
337 | */ |
||
338 | public function defaultFrom() |
||
342 | |||
343 | /** |
||
344 | * Set the default "Reply-To" email address. |
||
345 | * |
||
346 | * @param string|array $email The default "Reply-To" email address. |
||
347 | * @return self |
||
348 | */ |
||
349 | public function setDefaultReplyTo($email) |
||
354 | |||
355 | /** |
||
356 | * Get the "Reply-To" email address. |
||
357 | * |
||
358 | * @return string |
||
359 | */ |
||
360 | public function defaultReplyTo() |
||
364 | |||
365 | /** |
||
366 | * Set whether the email sending should be logged by default. |
||
367 | * |
||
368 | * @param boolean $log The default log flag. |
||
369 | * @return self |
||
370 | */ |
||
371 | public function setDefaultLogEnabled($log) |
||
376 | |||
377 | /** |
||
378 | * Determine if the email sending should be logged by default. |
||
379 | * |
||
380 | * @return boolean |
||
381 | */ |
||
382 | public function defaultLogEnabled() |
||
386 | |||
387 | /** |
||
388 | * Set whether the email (open) should be tracked by default. |
||
389 | * |
||
390 | * @param boolean $track The default track flag. |
||
391 | * @return self |
||
392 | */ |
||
393 | public function setDefaultTrackOpenEnabled($track) |
||
398 | |||
399 | /** |
||
400 | * Determine if the email (open) should be tracked by default. |
||
401 | * |
||
402 | * @return boolean |
||
403 | */ |
||
404 | public function defaultTrackOpenEnabled() |
||
408 | |||
409 | /** |
||
410 | * Set whether the email links should be tracked by default. |
||
411 | * |
||
412 | * @param boolean $track The default track flag. |
||
413 | * @return self |
||
414 | */ |
||
415 | public function setDefaultTrackLinksEnabled($track) |
||
420 | |||
421 | /** |
||
422 | * Determine if the email links should be tracked by default. |
||
423 | * |
||
424 | * @return boolean |
||
425 | */ |
||
426 | public function defaultTrackLinksEnabled() |
||
430 | } |
||
431 |