Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
sendEmail example
$endpoint
=
parse_url
(
$configuration
->
get
(
'endpoint'
)
)
;
$host
=
$endpoint
[
'host'
]
.
(
$endpoint
[
'port'
]
?? null ? ':'.
$endpoint
[
'port'
]
: ''
)
;
}
else
{
$host
=
$configuration
->
get
(
'region'
)
;
}
return
sprintf
(
'ses+https://%s@%s',
$configuration
->
get
(
'accessKeyId'
)
,
$host
)
;
}
protected
function
doSend
(
SentMessage
$message
)
: void
{
$result
=
$this
->sesClient->
sendEmail
(
$this
->
getRequest
(
$message
)
)
;
$response
=
$result
->
info
(
)
[
'response'
]
;
try
{
$message
->
setMessageId
(
$result
->
getMessageId
(
)
)
;
$message
->
appendDebug
(
$response
->
getInfo
(
'debug'
)
?? ''
)
;
}
catch
(
HttpException
$e
)
{
$exception
=
new
HttpTransportException
(
sprintf
(
'Unable to send an email: %s (code %s).',
$e
->
getAwsMessage
(
)
?:
$e
->
getMessage
(
)
,
$e
->
getAwsCode
(
)
?:
$e
->
getCode
(
)
)
,
$e
->
getResponse
(
)
,
$e
->
getCode
(
)
,
$e
)
;
$exception
->
appendDebug
(
$e
->
getResponse
(
)
->
getInfo
(
'debug'
)
?? ''
)
;
throw
$exception
;
}
}