Conditions | 4 |
Paths | 8 |
Total Lines | 34 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public function send(Envelope $envelope) |
||
20 | { |
||
21 | $mail = $this->prepareMailer($envelope); |
||
22 | |||
23 | // Call the preSend to set all PHPMailer variables and get the correct header and body; |
||
24 | $message = $mail->getFullMessageEnvelope(); |
||
25 | |||
26 | // Fix BCC header because PHPMailer does not send to us |
||
27 | foreach ((array) $envelope->getBCC() as $bccEmail) { |
||
28 | $message = 'Bcc: '.$bccEmail."\n".$message; |
||
29 | } |
||
30 | |||
31 | $domainName = $this->connection->getServer(); |
||
32 | |||
33 | $request = new WebRequest("https://api.mailgun.net/v3/$domainName/messages.mime"); |
||
34 | $request->setCredentials($this->connection->getUsername(), $this->connection->getPassword()); |
||
35 | |||
36 | $upload = [ |
||
37 | new UploadFile('message', $message, 'message.mime') |
||
38 | ]; |
||
39 | // Add "To;" |
||
40 | foreach ((array) $envelope->getTo() as $toEmail) { |
||
41 | $upload[] = new UploadFile('to', $toEmail); |
||
42 | } |
||
43 | |||
44 | $result = $request->postUploadFile($upload); |
||
|
|||
45 | |||
46 | $resultJson = json_decode($result, true); |
||
47 | if (!isset($resultJson['id'])) { |
||
48 | throw new Exception('Mailgun: '.$resultJson['message']); |
||
49 | } |
||
50 | |||
51 | return true; |
||
52 | } |
||
53 | } |
||
54 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.