public function newAction()
 {
     if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
         $session = Mage::getSingleton('core/session');
         $email = (string) $this->getRequest()->getPost('email');
         Mage::log("Fontis_CampaignMonitor: Adding newsletter subscription via frontend 'Sign up' block for {$email}");
         $apiKey = trim(Mage::getStoreConfig('newsletter/campaignmonitor/api_key'));
         $listID = trim(Mage::getStoreConfig('newsletter/campaignmonitor/list_id'));
         if ($apiKey && $listID) {
             try {
                 $client = new SoapClient("http://api.createsend.com/api/api.asmx?wsdl", array("trace" => true));
             } catch (Exception $e) {
                 Mage::log("Fontis_CampaignMonitor: Error connecting to CampaignMonitor server: " . $e->getMessage());
                 $session->addException($e, $this->__('There was a problem with the subscription'));
                 $this->_redirectReferer();
             }
             // if a user is logged in, fill in the Campaign Monitor custom
             // attributes with the data for the logged-in user
             $customerHelper = Mage::helper('customer');
             if ($customerHelper->isLoggedIn()) {
                 $customer = $customerHelper->getCustomer();
                 $name = $customer->getFirstname() . " " . $customer->getLastname();
                 $customFields = Fontis_CampaignMonitor_Model_Customer_Observer::generateCustomFields($customer);
                 try {
                     $result = $client->AddAndResubscribeWithCustomFields(array("ApiKey" => $apiKey, "ListID" => $listID, "Email" => $email, "Name" => $name, "CustomFields" => $customFields));
                 } catch (Exception $e) {
                     Mage::log("Fontis_CampaignMonitor: Error in CampaignMonitor SOAP call: " . $e->getMessage());
                     $session->addException($e, $this->__('There was a problem with the subscription'));
                     $this->_redirectReferer();
                 }
             } else {
                 // otherwise if nobody's logged in, ignore the custom
                 // attributes and just set the name to '(Guest)'
                 try {
                     $result = $client->AddAndResubscribe(array("ApiKey" => $apiKey, "ListID" => $listID, "Email" => $email, "Name" => "(Guest)"));
                 } catch (Exception $e) {
                     Mage::log("Fontis_CampaignMonitor: Error in CampaignMonitor SOAP call: " . $e->getMessage());
                     $session->addException($e, $this->__('There was a problem with the subscription'));
                     $this->_redirectReferer();
                 }
             }
         } else {
             Mage::log("Fontis_CampaignMonitor: Error: Campaign Monitor API key and/or list ID not set in Magento Newsletter options.");
         }
     }
     parent::newAction();
 }