<?php
$url = "https://api.inwise.com/rest/v1/transactional/emails/sendTemplate";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Content-Type: application/json",
"Accept: application/json",
"X-API-Key: XXXXXXXXXXX",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<<DATA
{
"template_id": 123456,
"template_content": {
"contents": [
{
"name": "name",
"content": "html"
}
]
},
"message": {
"html": " ",
"text": "text text",
"subject": "this is message from PHP code",
"from_email": "
[email protected]",
"reply_to": "
[email protected]",
"from_name": "from me",
"charset": "utf-8",
"content_type": "html",
"to": [
{
"email": "
[email protected]",
"name": "YYY",
"type": "to"
}
]
}
DATA;
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($curl);
curl_close($curl);
var_export($resp);
?>