elin-r
9/14/2017 - 8:18 PM

Send Trigger Mail with from values through Compost Carma API

Send Trigger Mail with from values through Compost Carma API

<?php
$url = 'https://www2.carmamail.com//rest/2377/triggers/3515/messages';

$ch = curl_init();
$data = array(
			'originalId' => $_POST["originalId"],
			'properties' => array(
				'emailAddress' => $_POST["emailAddress"],
			)
			);
$content = json_encode($data);

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_USERPWD,"stampenapikey:stampenpass");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $content);

$response = curl_exec($ch);
print $response . "\n\n";
$request_header_info = curl_getinfo($ch, CURLINFO_HEADER_OUT);
print $request_header_info;
curl_close($ch);
?>