/** * @see ExpressoLite\Backend\Request\LiteRequest::execute */ public function execute() { $subject = $this->param('subject'); $body = $this->param('body'); $to = $this->toArrayOfEmails($this->param('to')); $cc = $this->toArrayOfEmails($this->param('cc')); $bcc = $this->toArrayOfEmails($this->param('bcc')); $isImportant = $this->param('isImportant') == '1'; $replyToId = $this->emptyAsNull($this->param('replyToId')); $forwardFromId = $this->emptyAsNull($this->param('forwardFromId')); $origDraftId = $this->emptyAsNull($this->param('origDraftId')); $wantConfirm = $this->isParamSet('wantConfirm') ? $this->param('wantConfirm') == '1' : false; $attachs = $this->param('attachs'); if ($attachs != '') { $attachs = json_decode($attachs); } else { $attachs = array(); } $response = $this->jsonRpc('Expressomail.saveMessage', (object) array('recordData' => MessageUtils::buildMessageForSaving($this->tineSession, $subject, $body, $to, $cc, $bcc, $isImportant, $replyToId, $forwardFromId, $origDraftId, $attachs, $wantConfirm))); return $response->result; }
/** * @see ExpressoLite\Backend\Request\LiteRequest::execute */ public function execute() { $draftFolderId = $this->param('draftFolderId'); $subject = $this->param('subject'); $body = $this->param('body'); $to = $this->toArrayOfEmails($this->param('to')); $cc = $this->toArrayOfEmails($this->param('cc')); $bcc = $this->toArrayOfEmails($this->param('bcc')); $isImportant = $this->param('isImportant') == '1'; $replyToId = $this->emptyAsNull($this->param('replyToId')); $forwardFromId = $this->emptyAsNull($this->param('forwardFromId')); $origDraftId = $this->emptyAsNull($this->param('origDraftId')); $attachs = $this->param('attachs') != '' ? json_decode($this->param('attachs')) : array(); // array of tempFile objects $recordData = MessageUtils::buildMessageForSaving($this->tineSession, $subject, $body, $to, $cc, $bcc, $isImportant, $replyToId, $forwardFromId, $origDraftId, $attachs); $this->jsonRpc('Expressomail.saveMessageInFolder', (object) array('folderName' => 'INBOX/Drafts', 'recordData' => $recordData)); $draftMsg = $this->processor->executeRequest('searchHeadlines', array('folderIds' => $draftFolderId, 'start' => 0, 'limit' => 1)); // newest draft $result = MessageUtils::addOrClearFlag($this->tineSession, array($draftMsg[0]->id), "\\Seen", true); // because Tine saves new draft as unread return $result; }