ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Mb3SafeMailEncoder.php
Go to the documentation of this file.
1<?php
2
18declare(strict_types=1);
19
20namespace ILIAS\Mail\Object;
21
23{
24 public function __construct(
25 private readonly MailPayloadEncoder $inner,
26 private readonly \ILIAS\Mail\Transformation\Utf8Mb4Sanitizer $trafo
27 ) {
28 }
29
30 public function encode(array $mails): string
31 {
32 $sanitized = [];
33 foreach ($mails as $m) {
34 $sanitized[] = new \ilMailValueObject(
35 $m->getFrom(),
36 $m->getRecipients(),
37 $m->getRecipientsCC(),
38 $m->getRecipientsBCC(),
39 $this->trafo->transform($m->getSubject()),
40 $this->trafo->transform($m->getBody()),
41 $m->getAttachments(),
42 $m->isUsingPlaceholders(),
43 $m->shouldSaveInSentBox()
44 );
45 }
46
47 return $this->inner->encode($sanitized);
48 }
49}
__construct(private readonly MailPayloadEncoder $inner, private readonly \ILIAS\Mail\Transformation\Utf8Mb4Sanitizer $trafo)
A transformation is a function from one datatype to another.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
RFC 822 Email address list validation Utility.