/**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_smtpBackend = Tinebase_Notification_Factory::getBackend(Tinebase_Notification_Factory::SMTP);
 }
 /**
  * send an alarm (to responsible person and if it does not exist, to creator)
  *
  * @param  Tinebase_Model_Alarm $_alarm
  * @return void
  */
 public function sendAlarm(Tinebase_Model_Alarm $_alarm)
 {
     // save and disable container checks to be able to get all required tasks
     $oldCheckValue = $this->_doContainerACLChecks;
     $this->_doContainerACLChecks = FALSE;
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " About to send alarm " . print_r($_alarm->toArray(), TRUE));
     }
     try {
         $task = $this->get($_alarm->record_id);
         if ($task->organizer) {
             $organizerContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($task->organizer, TRUE);
         } else {
             // use creator as organizer
             $organizerContact = Addressbook_Controller_Contact::getInstance()->getContactByUserId($task->created_by, TRUE);
         }
         // create message
         $translate = Tinebase_Translation::getTranslation($this->_applicationName);
         $messageSubject = $translate->_('Notification for Task ' . $task->summary);
         $messageBody = $task->getNotificationMessage();
         $notificationsBackend = Tinebase_Notification_Factory::getBackend(Tinebase_Notification_Factory::SMTP);
         // send message
         if ($organizerContact->email && !empty($organizerContact->email)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Trying to send alarm email to ' . $organizerContact->email);
             }
             $notificationsBackend->send(NULL, $organizerContact, $messageSubject, $messageBody);
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                 Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Organizer / creator has no email address.');
             }
         }
     } catch (Exception $e) {
         $this->_doContainerACLChecks = $oldCheckValue;
         throw $e;
     }
 }