function eForm2MailBuild(&$fields) { $params = new stdclass(); $params->ApiKey = MB_API_KEY; $params->ListID = MB_LIST_ID; $params->Name = $fields['first_name'] . ' ' . $fields['last_name']; $params->Email = $fields['email']; try { $client = new SoapClient("http://api.createsend.com/api/api.asmx?wsdl", array('trace' => 1)); $result = get_object_vars($client->AddSubscriber($params)); $resultCode = current($result)->Code; $resultMessage = current($result)->Message; // If not successful if ($resultCode > 0) { $isError = true; } // The following code produces the entire service request and response. It may be useful for debugging. /* print "<pre>\n"; print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n"; print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n"; print "</pre>"; */ } catch (SoapFault $e) { // mail('*****@*****.**', 'error processing form', $e->getMessage()); // Uncomment and replace email address if you want to know when something goes wrong. // print_r($e); die(); // Uncomment to spit out debugging information and die on error. } return true; }