Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getRecipientsPayload example
private
function
getPayload
(
Email
$email
, Envelope
$envelope
)
: array
{
$payload
=
[
'key' =>
$this
->key,
'message' =>
[
'html' =>
$email
->
getHtmlBody
(
)
,
'text' =>
$email
->
getTextBody
(
)
,
'subject' =>
$email
->
getSubject
(
)
,
'from_email' =>
$envelope
->
getSender
(
)
->
getAddress
(
)
,
'to' =>
$this
->
getRecipientsPayload
(
$email
,
$envelope
)
,
]
,
]
;
if
(
'' !==
$envelope
->
getSender
(
)
->
getName
(
)
)
{
$payload
[
'message'
]
[
'from_name'
]
=
$envelope
->
getSender
(
)
->
getName
(
)
;
}
foreach
(
$email
->
getAttachments
(
)
as
$attachment
)
{
$headers
=
$attachment
->
getPreparedHeaders
(
)
;
$disposition
=
$headers
->
getHeaderBody
(
'Content-Disposition'
)
;