Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function send(string $subject, string $template, $mailData, string $to, String $from = null): bool |
||
29 | { |
||
30 | if ($from === null) { |
||
31 | $from = getenv('ADMIN_EMAIL'); |
||
32 | } |
||
33 | |||
34 | $message = (new Swift_Message($subject)) |
||
35 | ->setFrom($from) |
||
36 | ->setTo($to) |
||
37 | ; |
||
38 | $img = $message->embed(Swift_Image::fromPath('img/snowtricks-logo.png')); |
||
39 | $message |
||
40 | ->setBody( |
||
41 | $this->templating->render( |
||
42 | $template, |
||
43 | [ |
||
44 | 'mailData' => $mailData, |
||
45 | 'img' =>$img, |
||
46 | 'subject' => $subject, |
||
47 | ] |
||
48 | ), |
||
49 | 'text/html' |
||
50 | ); |
||
51 | |||
52 | return $this->mailer->send($message) > 0; |
||
53 | |||
56 | } |