|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (c) 2014 Roave, LLC. |
|
4
|
|
|
* All rights reserved. |
|
5
|
|
|
* |
|
6
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
7
|
|
|
* modification, are permitted provided that the following conditions |
|
8
|
|
|
* are met: |
|
9
|
|
|
* |
|
10
|
|
|
* * Redistributions of source code must retain the above copyright |
|
11
|
|
|
* notice, this list of conditions and the following disclaimer. |
|
12
|
|
|
* |
|
13
|
|
|
* * Redistributions in binary form must reproduce the above copyright |
|
14
|
|
|
* notice, this list of conditions and the following disclaimer in |
|
15
|
|
|
* the documentation and/or other materials provided with the |
|
16
|
|
|
* distribution. |
|
17
|
|
|
* |
|
18
|
|
|
* * Neither the names of the copyright holders nor the names of the |
|
19
|
|
|
* contributors may be used to endorse or promote products derived |
|
20
|
|
|
* from this software without specific prior written permission. |
|
21
|
|
|
* |
|
22
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
23
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
24
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
25
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
26
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
27
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
28
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
29
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
30
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
31
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
32
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
33
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
|
34
|
|
|
* |
|
35
|
|
|
* @author Antoine Hedgecock |
|
36
|
|
|
* |
|
37
|
|
|
* @copyright 2014 Roave, LLC |
|
38
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
39
|
|
|
*/ |
|
40
|
|
|
|
|
41
|
|
|
namespace Roave\EmailTemplates\Options; |
|
42
|
|
|
|
|
43
|
|
|
use Zend\Mail\Transport\Sendmail; |
|
44
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Class EmailServiceOptions |
|
48
|
|
|
* |
|
49
|
|
|
* A list of available configuration options for the EmaiService {@see \Roave\EmailTemplates\Service\EmailService} |
|
50
|
|
|
* |
|
51
|
|
|
* @property array $bcc |
|
52
|
|
|
* @property string $defaultTransport |
|
53
|
|
|
* @property string $from |
|
54
|
|
|
* @property string $replyTo |
|
55
|
|
|
* @property string $encoding |
|
56
|
|
|
* @property string $defaultLocale |
|
57
|
|
|
*/ |
|
58
|
|
|
class EmailServiceOptions extends AbstractOptions |
|
59
|
|
|
{ |
|
60
|
|
|
/** |
|
61
|
|
|
* @var array |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $bcc = array(); |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @var string |
|
67
|
|
|
*/ |
|
68
|
|
|
protected $defaultTransport = Sendmail::class; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @var string|null |
|
72
|
|
|
*/ |
|
73
|
|
|
protected $from = 'webmaster@localhost'; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @var string|null |
|
77
|
|
|
*/ |
|
78
|
|
|
protected $replyTo = 'noreply@localhost'; |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @var string |
|
82
|
|
|
*/ |
|
83
|
|
|
protected $encoding = 'utf-8'; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @var string |
|
87
|
|
|
*/ |
|
88
|
|
|
protected $defaultLocale = 'en-US'; |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @param string $defaultLocale |
|
92
|
|
|
*/ |
|
93
|
1 |
|
public function setDefaultLocale(string $defaultLocale) |
|
94
|
|
|
{ |
|
95
|
1 |
|
$this->defaultLocale = $defaultLocale; |
|
96
|
1 |
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @return string |
|
100
|
|
|
*/ |
|
101
|
1 |
|
public function getDefaultLocale(): string |
|
102
|
|
|
{ |
|
103
|
1 |
|
return $this->defaultLocale; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @param array $bcc |
|
108
|
|
|
*/ |
|
109
|
1 |
|
public function setBcc(array $bcc): void |
|
110
|
|
|
{ |
|
111
|
1 |
|
$this->bcc = $bcc; |
|
112
|
1 |
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @return array |
|
116
|
|
|
*/ |
|
117
|
1 |
|
public function getBcc(): array |
|
118
|
|
|
{ |
|
119
|
1 |
|
return $this->bcc; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param string $defaultTransport |
|
124
|
|
|
*/ |
|
125
|
1 |
|
public function setDefaultTransport(string $defaultTransport): void |
|
126
|
|
|
{ |
|
127
|
1 |
|
$this->defaultTransport = $defaultTransport; |
|
128
|
1 |
|
} |
|
129
|
|
|
|
|
130
|
|
|
/** |
|
131
|
|
|
* @return string |
|
132
|
|
|
*/ |
|
133
|
1 |
|
public function getDefaultTransport(): string |
|
134
|
|
|
{ |
|
135
|
1 |
|
return $this->defaultTransport; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @param $encoding |
|
140
|
|
|
*/ |
|
141
|
1 |
|
public function setEncoding(string $encoding): void |
|
142
|
|
|
{ |
|
143
|
1 |
|
$this->encoding = $encoding; |
|
144
|
1 |
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* @return string |
|
148
|
|
|
*/ |
|
149
|
1 |
|
public function getEncoding(): string |
|
150
|
|
|
{ |
|
151
|
1 |
|
return $this->encoding; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @param $from |
|
156
|
|
|
*/ |
|
157
|
1 |
|
public function setFrom(string $from): void |
|
158
|
|
|
{ |
|
159
|
1 |
|
$this->from = $from; |
|
160
|
1 |
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @return string |
|
164
|
|
|
*/ |
|
165
|
1 |
|
public function getFrom(): string |
|
166
|
|
|
{ |
|
167
|
1 |
|
return $this->from; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* @param string $replyTo |
|
172
|
|
|
*/ |
|
173
|
1 |
|
public function setReplyTo(string $replyTo): void |
|
174
|
|
|
{ |
|
175
|
1 |
|
$this->replyTo = $replyTo; |
|
176
|
1 |
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* @return string |
|
180
|
|
|
*/ |
|
181
|
1 |
|
public function getReplyTo(): string |
|
182
|
|
|
{ |
|
183
|
1 |
|
return $this->replyTo; |
|
184
|
|
|
} |
|
185
|
|
|
} |
|
186
|
|
|
|