Esempio n. 1
0
 /**
  * @return array
  */
 public function AjaxMessageSendConfirmation()
 {
     $oAccount = $this->getAccountFromParam();
     $oMessage = $this->buildConfirmationMessage($oAccount);
     if ($oMessage) {
         try {
             $mResult = $this->oApiMail->MessageSend($oAccount, $oMessage);
         } catch (\CApiManagerException $oException) {
             $iCode = \ProjectSeven\Notifications::CanNotSendMessage;
             switch ($oException->getCode()) {
                 case \Errs::Mail_InvalidRecipients:
                     $iCode = \ProjectSeven\Notifications::InvalidRecipients;
                     break;
                 case \Errs::Mail_CannotSendMessage:
                     $iCode = \ProjectSeven\Notifications::CanNotSendMessage;
                     break;
             }
             throw new \ProjectSeven\Exceptions\ClientException($iCode, $oException);
         }
         $sConfirmFolderFullNameRaw = $this->getParamValue('ConfirmFolder', '');
         $sConfirmUid = $this->getParamValue('ConfirmUid', '');
         if (0 < \strlen($sConfirmFolderFullNameRaw) && 0 < \strlen($sConfirmUid)) {
             try {
                 $mResult = $this->oApiMail->MessageFlag($oAccount, $sConfirmFolderFullNameRaw, array($sConfirmUid), '$ReadConfirm', \EMailMessageStoreAction::Add, false, true);
             } catch (\Exception $oException) {
             }
         }
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $mResult);
 }
Esempio n. 2
0
 /**
  *
  * @param CAccount $oAccount
  * @param string $sSubject
  * @param string $sEventName
  * @param string $sDate
  * @param string $sCalendarName
  * @param string $sEventText
  * @param string $sCalendarColor
  *
  * @return bool
  */
 private function sendMessage($oAccount, $sSubject, $sEventName, $sDate, $sCalendarName, $sEventText, $sCalendarColor)
 {
     $oMessage = $this->createMessage($oAccount, $sSubject, $this->createBodyHtml($oAccount, $sEventName, $sDate, $sCalendarName, $sEventText, $sCalendarColor), $this->createBodyText($oAccount, $sEventName, $sDate, $sCalendarName, $sEventText));
     try {
         return $this->oApiMailManager->MessageSend($oAccount, $oMessage);
     } catch (Exception $oException) {
         CApi::Log('MessageSend Exception', ELogLevel::Error, 'cron-');
         CApi::LogException($oException, ELogLevel::Error, 'cron-');
     }
     return false;
 }