19 declare(strict_types=1);
32 foreach ($mailValueObjects as $mailValueObject) {
35 $array[
'from'] = $mailValueObject->getFrom();
36 $array[
'recipients'] = $mailValueObject->getRecipients();
37 $array[
'recipients_cc'] = $mailValueObject->getRecipientsCC();
38 $array[
'recipients_bcc'] = $mailValueObject->getRecipientsBCC();
39 $array[
'attachments'] = $mailValueObject->getAttachments();
40 $array[
'body'] = $mailValueObject->getBody();
41 $array[
'subject'] = $mailValueObject->getSubject();
42 $array[
'is_using_placholders'] = $mailValueObject->isUsingPlaceholders();
43 $array[
'should_save_in_sent_box'] = $mailValueObject->shouldSaveInSentBox();
45 $mailArray[] = $array;
48 return json_encode($mailArray, JSON_THROW_ON_ERROR);
57 $array = json_decode($json,
true, 512, JSON_THROW_ON_ERROR);
59 foreach ($array as $objectValues) {
61 $objectValues[
'from'],
62 $objectValues[
'recipients'],
63 $objectValues[
'recipients_cc'],
64 $objectValues[
'recipients_bcc'],
65 ilStr::strLen($objectValues[
'subject']) > 255 ? ilStr::substr($objectValues[
'subject'], 0, 255) : $objectValues[
'subject'],
66 $objectValues[
'body'],
67 $objectValues[
'attachments'],
68 $objectValues[
'is_using_placholders'],
69 $objectValues[
'should_save_in_sent_box']
convertFromJson(string $json)
convertToJson(array $mailValueObjects)
static strLen(string $a_string)