/**
  * This function handles the referred underwriting state, including unsetting the session
  *
  * @return void
  */
 public function referredAction()
 {
     // Show the policy number to the end user
     $session = new Zend_Session_Namespace('landlords_insurance_quote');
     $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($session->quoteID);
     $this->view->policyNumber = $quoteManager->getLegacyID();
     // Pop an e-mail to the end user
     $params = Zend_Registry::get('params');
     $customerManager = new Manager_Core_Customer();
     $customer = $customerManager->getCustomer(Model_Core_Customer::LEGACY_IDENTIFIER, $this->_customerReferenceNumber);
     $replacements = array('title' => $customer->getTitle(), 'firstName' => $customer->getFirstName(), 'lastName' => $customer->getLastName(), 'fullName' => $customer->getTitle() . ' ' . $customer->getFirstName() . ' ' . $customer->getLastName(), 'quoteNumber' => $this->view->policyNumber, 'imageBaseUrl' => $this->_params->weblead->mailer->imageBaseUrl);
     $subjectLine = $params->weblead->mailer->landlord->referredQuote->subject;
     foreach ($replacements as $key => $val) {
         $subjectLine = str_replace("[{$key}]", $val, $subjectLine);
     }
     $replacements['pageTitle'] = $subjectLine;
     $template = $params->weblead->mailer->landlord->referredQuote->template;
     $mail = new Application_Core_Mail();
     $mail->setTo($customer->getEmailAddress(), $replacements['fullName'])->setFrom($params->weblead->mailer->fromAddress, $params->weblead->mailer->fromName)->setSubject($subjectLine)->applyTemplate($template, $replacements, true);
     $mail->send();
     // Tag quote as mailer sent, stops abandone quote mailer cron from sending a continue mailer
     $webLeadManager = new Manager_Core_WebLead();
     $webLeadManager->setIsMailerSent($quoteManager->getLegacyID(), true);
     // Unset the session to prevent navigation to other steps
     Zend_Session::namespaceUnset('landlords_insurance_quote');
 }