public function getEmails()
 {
     $this->emails = array();
     $xml = $this->getURL("/people/" . $this->id . "/emails.xml");
     $xml_obj = simplexml_load_string($xml);
     if ($this->debug == true) {
     }
     print_r($xml_obj);
     if (isset($xml_obj->email) && count($xml_obj->email) > 0) {
         foreach ($xml_obj->email as $xml_email) {
             $email = new HighriseEmail($this->highrise);
             $email->loadFromXMLObject($xml_email);
             $this->addEmail($email);
         }
     }
     return $this->emails;
 }
    die("Usage: php emails.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
$people = $hr->findPeopleBySearchTerm("Person Test");
$person = $people[0];
$emails = $person->getEmails();
foreach ($emails as $email) {
    print_r($email);
    print $email->toXML();
}
print $person->getId();
// Create new note
$new_email = new HighriseEmail($hr);
$new_email->debug = false;
$new_email->setSubjectType("Party");
$new_email->setSubjectId($person->getId());
$new_email->setTitle("Test Email");
$new_email->setBody("Test");
$new_email->save();
print "New email ID: " . $new_email->getId() . " Created at: " . $new_email->getCreatedAt() . "\n";
print "Updating email...";
$new_email->setBody("Testi");
$new_email->setTitle("Test Title");
$new_email->save();
$find_new_email = $hr->findEmailByID($new_email->id);
if ($find_new_email->getBody() != $new_email->getBody()) {
    throw new Exception("Retrieving a note by ID failed");
}
 public function get_email($id)
 {
     $xml = $this->make_request('emails/' . $id);
     $this->check_for_errors('Email');
     $xml_object = simplexml_load_string($xml);
     $email = new HighriseEmail($this);
     $email->load_from_xml_object($xml_object);
     return $email;
 }