1 | <?php |
||
9 | class Mailer extends SilverstripeMailer |
||
10 | { |
||
11 | /** |
||
12 | * @var string |
||
13 | * @config |
||
14 | */ |
||
15 | private static $api_domain = ''; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | * @config |
||
20 | */ |
||
21 | private static $api_endpoint = 'api.mailgun.net'; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | * @config |
||
26 | */ |
||
27 | private static $api_key = ''; |
||
28 | |||
29 | /** |
||
30 | * @var boolean |
||
31 | * @config |
||
32 | */ |
||
33 | private static $api_ssl = true; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | * @config |
||
38 | */ |
||
39 | private static $api_version = 'v3'; |
||
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() |
|
65 | |||
66 | /** |
||
67 | * @param Mailgun $client |
||
68 | * @return self |
||
69 | */ |
||
70 | 12 | public function setMailgunClient(Mailgun $client) |
|
75 | |||
76 | /** |
||
77 | * @return Mailgun |
||
78 | */ |
||
79 | 1 | public function getMailgunClient() |
|
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | */ |
||
87 | 1 | public function sendPlain($to, $from, $subject, $plainContent, $attachments = [], $headers = []) |
|
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 1 | public function sendHTML($to, $from, $subject, $htmlContent, $attachments = [], $headers = [], $plainContent = '') |
|
99 | |||
100 | /** |
||
101 | * @param string $to |
||
102 | * @param string $from |
||
103 | * @param string $subject |
||
104 | * @param string $content |
||
105 | * @param string $plainContent |
||
106 | * @param array $attachments |
||
107 | * @param array $headers |
||
108 | */ |
||
109 | 3 | protected function sendMessage($to, $from, $subject, $content, $plainContent, $attachments, $headers) |
|
141 | |||
142 | /** |
||
143 | * @param MessageBuilder $builder |
||
144 | * @param string $to |
||
145 | * @param string $from |
||
146 | * @param string $subject |
||
147 | * @param string $content |
||
148 | * @param string $plainContent |
||
149 | * @param string $attachments |
||
150 | * @param array $headers |
||
151 | */ |
||
152 | 2 | protected function buildMessage(MessageBuilder $builder, $to, $from, $subject, $content, $plainContent, $attachments, $headers) |
|
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 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: