Update Email Message (put)

Update Email Message (put) | Update an existing email message.
<?php
//example PHP code to update an email message
//set values of email message to update
$put_params['apiKey']="APIKEY_HERE";
$put_params['id']="FROMID_HERE"; //Id of the email message.
//Optional fields commented out below:
//$put_params['fromid']="FROMID_HERE"; //Id of email address to send email from.
//$put_params['subject']="SUBJECT_HERE"; //Subject of the email message. Max length is 500 characters.
//$put_params['emailhtml']="EMAILHTML_HERE"; //The text/html version of the email message.
//$put_params['emailname']="EMAILNAME_HERE"; //A reference name for the email, used in reporting. Max length is 255 characters.
//$put_params['emailplain']="EMAILPLAIN_HERE"; //The plain/text version of the email.
//$put_params['emailaol']="EMALAOL_HERE"; //The mobile version of the email.
//$put_params['folderid']="0"; //Id of the message folder. Defaults to 0.

$url = 'http://apidomain.com/api2/messages/email';

//Puts this using CURL
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); 
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($curl, CURLOPT_POSTFIELDS,http_build_query($put_params));
$result = curl_exec ($curl);
curl_close ($curl);
echo $result;

//Parse the json to get return values. 
$parsed_result = json_decode($result,false);

echo "<br><br>Status: $parsed_result->status";
echo "<br>Message: $parsed_result->message";
echo "<br>Error Code: $parsed_result->errorcode";
echo "<br>Error Message: $parsed_result->errormessage";
echo "<br>Email Message Id: ";
echo $parsed_result->data->id;
echo "<br>Subject:";
echo $parsed_result->data->subject;
echo "<br>Email Name:";
echo $parsed_result->data->emailname;
?>