Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getDefaultMailContext example
if
(
!
$this
->
Request
(
)
->
getParam
(
'value'
)
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'message' => 'Value not found'
]
)
;
}
$recipient
=
Shopware
(
)
->
Config
(
)
->
get
(
'mail'
)
;
$shop
=
$this
->
get
(
'models'
)
->
getRepository
(
Shop::
class
)
->
getActiveDefault
(
)
;
$this
->
get
(
ShopRegistrationServiceInterface::
class
)
->
registerShop
(
$shop
)
;
try
{
$templateMail
=
Shopware
(
)
->
TemplateMail
(
)
->
createMail
(
$mail
,
array_merge
(
$this
->
getDefaultMailContext
(
$shop
)
,
$mail
->
getContext
(
)
)
,
$shop
)
;
$templateMail
->
addTo
(
$recipient
)
;
$templateMail
->
setAssociation
(
AdministrativeMailFilter::ADMINISTRATIVE_MAIL, true
)
;
$templateMail
->
send
(
)
;
}
catch
(
Exception
$e
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'message' =>
$e
->
getMessage
(
)
]
)
;
return
;
}
$this
->
View
(
)
->
assign
(
[
'success' => true
]
)
;
}