Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMailAttachmentsConfig example
$attachmentsConfig
=
new
MailAttachmentsConfig
(
Context::
createDefaultContext
(
)
,
new
MailTemplateEntity
(
)
,
new
MailSendSubscriberConfig
(
false
)
,
[
]
,
Uuid::
randomHex
(
)
)
;
$mail
->
setMailAttachmentsConfig
(
$attachmentsConfig
)
;
static
::
assertEquals
(
$attachmentsConfig
,
$mail
->
getMailAttachmentsConfig
(
)
)
;
}
}
foreach
(
$message
->
getAttachmentUrls
(
)
as
$url
)
{
try
{
$mimeType
=
$this
->filesystem->
mimeType
(
$url
)
;
}
catch
(
UnableToRetrieveMetadata
)
{
$mimeType
= null;
}
$message
->
attach
(
$this
->filesystem->
read
(
$url
)
?: '',
basename
(
$url
)
,
$mimeType
)
;
}
$config
=
$message
->
getMailAttachmentsConfig
(
)
;
if
(
!
$config
)
{
return
$this
->decorated->
send
(
$message
,
$envelope
)
;
}
$attachments
=
$this
->attachmentsBuilder->
buildAttachments
(
$config
->
getContext
(
)
,
$config
->
getMailTemplate
(
)
,
$config
->
getExtension
(
)
,
$config
->
getEventConfig
(
)
,
$config
->
getOrderId
(
)
)
;