source: trunk/prototype/rest/mail/SendSupportFeedbackResource.php @ 7342

Revision 7342, 1.5 KB checked in by alexandrecorreia, 12 years ago (diff)

Ticket #3093 - Integrando API Rest(CELEPAR) com o ramo Trunk.

Line 
1<?php
2
3class SendSupportFeedbackResource 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                        $msgBody = $this->getParam("message");
11
12                        $params['input_to'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_to'];
13                        $params['input_cc'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_cc'];
14                        $params['input_cc'] = $GLOBALS['phpgw_info']['server']['sugestoes_email_bcc'];
15                        $params['input_subject'] = lang("Suggestions");
16                        $params['body'] = $msgBody;
17                        $params['type'] = 'textplain';
18
19                        $GLOBALS['phpgw']->preferences->read_repository();
20                        $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
21                        $boemailadmin   = CreateObject('emailadmin.bo');
22                        $emailadmin_profile = $boemailadmin->getProfileList();
23                        $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
24                        $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];
25                        $_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
26
27                        $expressoMail = CreateObject('expressoMail1_2.imap_functions');
28                        $returncode   = $expressoMail->send_mail($params);
29
30                        if (!$returncode || !(is_array($returncode) && $returncode['success'] == true))
31                                Errors::runException("MAIL_NOT_SENT");
32                }
33
34                $this->setResult(true);
35
36                //to Send Response (JSON RPC format)
37                return $this->getResponse();
38        }
39
40}
Note: See TracBrowser for help on using the repository browser.