1 | <?php |
||
15 | class Mailer extends SilverstripeMailer |
||
16 | { |
||
17 | /** |
||
18 | * @var string |
||
19 | * @config |
||
20 | */ |
||
21 | private static $api_domain = ''; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | * @config |
||
26 | */ |
||
27 | private static $api_endpoint = ''; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | * @config |
||
32 | */ |
||
33 | private static $api_key = ''; |
||
34 | |||
35 | /** |
||
36 | * @var boolean |
||
37 | * @config |
||
38 | */ |
||
39 | private static $debug = false; |
||
40 | |||
41 | /** |
||
42 | * An array of temporary file handles opened to store attachments |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $tempFileHandles = []; |
||
46 | |||
47 | /** |
||
48 | * @var Mailgun |
||
49 | */ |
||
50 | protected $mailgunClient; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 12 | public function __construct() |
|
68 | |||
69 | /** |
||
70 | * @param Mailgun $client |
||
71 | * @return self |
||
72 | */ |
||
73 | 12 | public function setMailgunClient(Mailgun $client) |
|
78 | |||
79 | /** |
||
80 | * @return Mailgun |
||
81 | */ |
||
82 | 1 | public function getMailgunClient() |
|
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | 1 | public function sendPlain($to, $from, $subject, $plainContent, $attachments = [], $headers = []) |
|
94 | |||
95 | /** |
||
96 | * {@inheritdoc} |
||
97 | */ |
||
98 | 1 | public function sendHTML($to, $from, $subject, $htmlContent, $attachments = [], $headers = [], $plainContent = '') |
|
102 | |||
103 | /** |
||
104 | * @param string $to |
||
105 | * @param string $from |
||
106 | * @param string $subject |
||
107 | * @param string $content |
||
108 | * @param string $plainContent |
||
109 | * @param array $attachments |
||
110 | * @param array $headers |
||
111 | */ |
||
112 | 3 | protected function sendMessage($to, $from, $subject, $content, $plainContent, $attachments, $headers) |
|
151 | |||
152 | /** |
||
153 | * @param MessageBuilder $builder |
||
154 | * @param string $to |
||
155 | * @param string $from |
||
156 | * @param string $subject |
||
157 | * @param string $content |
||
158 | * @param string $plainContent |
||
159 | * @param array $attachments |
||
160 | * @param array $headers |
||
161 | */ |
||
162 | 2 | protected function buildMessage( |
|
217 | |||
218 | /** |
||
219 | * @todo This can't deal with mismatched quotes, or commas in names. |
||
220 | * E.g. "Smith, John" <[email protected]> or "John O'smith" <[email protected]> |
||
221 | * @param string |
||
222 | * @return array |
||
223 | */ |
||
224 | 3 | protected function parseAddresses($addresses) |
|
243 | |||
244 | /** |
||
245 | * Prepare attachments for sending. SilverStripe extracts the content and |
||
246 | * passes that to the mailer, so to save encoding it we just write them all |
||
247 | * to individual files and let Mailgun deal with the rest. |
||
248 | * |
||
249 | * @todo Can we handle this better? |
||
250 | * @param array $attachments |
||
251 | * @return array |
||
252 | */ |
||
253 | 2 | protected function prepareAttachments(array $attachments) |
|
268 | |||
269 | /** |
||
270 | * @param string $contents |
||
271 | * @return string |
||
272 | */ |
||
273 | 2 | protected function writeToTempFile($contents) |
|
286 | |||
287 | /** |
||
288 | * @return void |
||
289 | */ |
||
290 | 1 | protected function closeTempFileHandles() |
|
298 | } |
||
299 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.