Conditions | 3 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
43 | public function send(TemplateInterface $template, $emails): bool |
||
44 | { |
||
45 | $message = (new Swift_Message()) |
||
46 | ->setSubject($template->getSubject()) |
||
47 | ->setFrom($template->getSenderEmail()) |
||
48 | ->setTo($emails) |
||
49 | ->setBody($template->getBody()) |
||
50 | ->setContentType('text/html'); |
||
51 | dd($message); |
||
52 | if ($template instanceof AttachmentsAwareInterface) { |
||
53 | foreach ($template->getAttachments() as $templateAttachment) { |
||
54 | $attachment = (new Swift_Attachment()) |
||
55 | ->setFilename($templateAttachment->getFileName()) |
||
56 | ->setBody($templateAttachment->getFileContent()); |
||
57 | |||
58 | $message->attach($attachment); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | return (bool)$this->mailer->send($message); |
||
63 | } |
||
64 | } |
||
65 |