CodeExplorer prepareAttachments example
private function getPayload(Email
$email, Envelope
$envelope): array
{ $html =
$email->
getHtmlBody();
if (null !==
$html && \
is_resource($html)) { if (stream_get_meta_data($html)['seekable'
] ?? false
) { rewind($html);
} $html =
stream_get_contents($html);
} [$attachments,
$inlines,
$html] =
$this->
prepareAttachments($email,
$html);
$message =
[ 'From' =>
$this->
formatAddress($envelope->
getSender()),
'To' =>
$this->
formatAddresses($this->
getRecipients($email,
$envelope)),
'Subject' =>
$email->
getSubject(),
'Attachments' =>
$attachments,
'InlinedAttachments' =>
$inlines,
];
if ($emails =
$email->
getCc()) { $message['Cc'
] =
$this->
formatAddresses($emails);
} private function getPayload(Email
$email, Envelope
$envelope): array
{ $headers =
$email->
getHeaders();
$html =
$email->
getHtmlBody();
if (null !==
$html && \
is_resource($html)) { if (stream_get_meta_data($html)['seekable'
] ?? false
) { rewind($html);
} $html =
stream_get_contents($html);
} [$attachments,
$inlines,
$html] =
$this->
prepareAttachments($email,
$html);
$payload =
[ 'from' =>
$envelope->
getSender()->
toString(),
'to' =>
implode(',',
$this->
stringifyAddresses($this->
getRecipients($email,
$envelope))),
'subject' =>
$email->
getSubject(),
'attachment' =>
$attachments,
'inline' =>
$inlines,
];
if ($emails =
$email->
getCc()) { $payload['cc'
] =
implode(',',
$this->
stringifyAddresses($emails));
}