/**
  * Connects to the Mail API and calls the desired
  * function with the specified parameters
  * 
  * @param  method to invoke and parameters for the method
  * @return mixed
  */
 public function executeMethod($method, $params)
 {
     $host = getenv("MAILAPI_URL") ? getenv("MAILAPI_URL") : MAILAPI_ENDPOINT;
     $params['apikey'] = new xmlrpcval($this->apikey);
     $xmlrpcmsg = new xmlrpcmsg($method, array(new xmlrpcval($params, 'struct')));
     $xmlrpc_client = new xmlrpc_client($host);
     $xmlrpc_client->request_charset_encoding = "UTF-8";
     $xmlrpc_client->SetUserAgent(MAILAPI_PARTNER . "/PHP/v" . MAILAPI_VERSION);
     $response = $xmlrpc_client->send($xmlrpcmsg);
     if (!$response->faultCode()) {
         return php_xmlrpc_decode($response->value());
     } else {
         return new MAILAPI_Error($response->faultCode(), $response->faultString());
     }
 }