delboy1978uk /
bone-mail
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | namespace Bone\Mail\Service; |
||
| 4 | |||
| 5 | use Bone\View\ViewEngine; |
||
| 6 | use Bone\Server\SiteConfig; |
||
| 7 | use Bone\Server\SiteConfigAwareInterface; |
||
| 8 | use Bone\Server\Traits\HasSiteConfigTrait; |
||
| 9 | use Bone\View\Traits\HasViewTrait; |
||
| 10 | use Bone\View\ViewAwareInterface; |
||
| 11 | use Bone\Mail\EmailMessage; |
||
| 12 | |||
| 13 | use Laminas\Mime\Message; |
||
|
0 ignored issues
–
show
|
|||
| 14 | use Laminas\Mime\Part; |
||
|
0 ignored issues
–
show
The type
Laminas\Mime\Part was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | use Symfony\Component\Mailer\Mailer; |
||
| 16 | use Symfony\Component\Mailer\Transport\TransportInterface; |
||
| 17 | |||
| 18 | class MailService implements SiteConfigAwareInterface, ViewAwareInterface |
||
| 19 | { |
||
| 20 | |||
| 21 | use HasSiteConfigTrait; |
||
| 22 | use HasViewTrait; |
||
| 23 | |||
| 24 | private Mailer $mailer; |
||
| 25 | |||
| 26 | public function setMailer(Mailer $mailer): void |
||
| 27 | { |
||
| 28 | 2 | $this->mailer = $mailer; |
|
| 29 | } |
||
| 30 | 2 | ||
| 31 | private function renderEmail(string $template, array $data): string |
||
| 32 | { |
||
| 33 | return $this->view->render($template, $data); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function sendEmail(EmailMessage $message): bool |
||
| 37 | { |
||
| 38 | 1 | $config = $this->getSiteConfig(); |
|
| 39 | $message->setFrom($config->getServerEmail(), $config->getCompany()); |
||
| 40 | 1 | $body = $this->renderEmail($message->getTemplate(), $message->getViewData()); |
|
| 41 | $message->html($body); |
||
| 42 | $this->mailer->send($message); |
||
| 43 | |||
| 44 | return true; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths