<!-- Intent: Create a new E-mail message using a minimal set of options
	-->


<?php
$url = 'http://api.v4.swiftreach.com/api/Messages/Email/Create/Simple';
$authToken = '123456';

$jsonString = ' 
{ 
	"Name":"API JSON SIMPLE Email 2", 
	"Description":"created by JSON api 2", 
	"FromName":"SwiftAPI", 
	"FromAddress":"alerts@swiftreach.com", 
	"Subject":"my subject", 
	"Body":"this is the body of my email", 
}';


$headers = array(
    'Content-type: application/json',
    'SwiftAPI-Key: ' . $authToken,
    'Accept: application/json',
    'Expect:'
);
$ch = curl_init();
$args = array(
    CURLOPT_URL => $url,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_POST => TRUE,
    CURLOPT_POSTFIELDS => $jsonString,
    CURLOPT_HTTPHEADER => $headers,
);
curl_setopt_array($ch, $args);
$res = curl_exec($ch);
$res_data = json_decode($res, true);
print($res_data);
?>

<!-- example return value -->
123456