CodeExplorer prepareAddresses example
private function getPayload(Email
$email, Envelope
$envelope): array
{ $sender =
$envelope->
getSender();
$payload =
[ 'from' =>
array_filter([ 'email' =>
$sender->
getAddress(),
'name' =>
$sender->
getName(),
]),
'to' =>
$this->
prepareAddresses($this->
getRecipients($email,
$envelope)),
'subject' =>
$email->
getSubject(),
];
if ($attachments =
$this->
prepareAttachments($email)) { $payload['attachments'
] =
$attachments;
} if ($replyTo =
$email->
getReplyTo()) { $payload['reply_to'
] =
current($this->
prepareAddresses($replyTo));
}