source: sandbox/webservice/api/rest/mail/SendResource.php @ 6619

Revision 6619, 1.3 KB checked in by niltonneto, 12 years ago (diff)

Ticket #2507 - Corrigido envio de email para respeitar preferência do usuário.

  • Property svn:executable set to *
Line 
1<?php
2
3class SendResource extends MailAdapter {
4        public function post($request){
5                // to Receive POST Params (use $this->params)
6                parent::post($request);
7
8                if($this-> isLoggedIn())
9                {
10                        // parametros recuperados conforme draft
11                        $msgForwardTo           = $this->getParam("msgForwardTo");
12                        $originalMsgID          = $this->getParam("originalMsgID");
13                        $originalUserAction     = $this->getParam("originalUserAction");
14
15                        $params['input_subject']        = $this->getParam("msgSubject");
16                        $params['input_to']                     = $this->getParam("msgTo");
17                        $params['input_cc']                     = $this->getParam("msgCcTo");
18                        $params['input_cco']            = $this->getParam("msgBccTo");
19                        $params['input_replyto']        = $this->getParam("msgReplyTo");
20                        $params['body']                         = $this->getParam("msgBody");
21                        $params['type']                         = $this->getParam("msgType") ? $this->getParam("msgType") : "plain";
22                        $params['folder'] =     
23                                $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] == "-1" ? "null" :
24                                $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'];
25
26                        $returncode = $this->getImap()->send_mail($params);
27                        if (!$returncode || !(is_array($returncode) && $returncode['success'] == true))
28                                Errors::runException("MAIL_NOT_SENT");
29                }
30
31                $this->setResult(true);
32
33                //to Send Response (JSON RPC format)
34                return $this->getResponse();
35        }
36
37}
Note: See TracBrowser for help on using the repository browser.