Changeset 6666
- Timestamp:
- 06/27/12 17:55:11 (12 years ago)
- Location:
- sandbox/webservice/api
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/adapters/MailAdapter.php
r6499 r6666 36 36 protected function getImap(){ 37 37 if($this->imap == null) { 38 $c = CreateObject('phpgwapi.config','expressoMail1_2'); 39 $c->read_repository(); 40 $current_config = $c->config_data; 38 41 $boemailadmin = CreateObject('emailadmin.bo'); 39 42 $emailadmin_profile = $boemailadmin->getProfileList(); -
sandbox/webservice/api/config/Errors.tsv
r6495 r6666 39 39 1016 MAIL_INVALID_MESSAGE Message does not exists. 40 40 1017 MAIL_TRASH_FOLDER_NOT_EXISTS Trash folder does not exists. 41 1018 MAIL_NOT_SENT_LIMIT_EXCEEDED The size of this message has exceeded the limit (%1B). -
sandbox/webservice/api/rest/mail/SendResource.php
r6664 r6666 24 24 $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']; 25 25 26 if( $this->getExpressoVersion() != "2.2" &&count($_FILES))26 if(count($_FILES)) 27 27 { 28 require_once (__DIR__.'/../../../prototype/api/controller.php');29 28 $files = array(); 29 $totalSize = 0; 30 30 foreach( $_FILES as $name => $file ) 31 31 { … … 36 36 'error' => $file['error'] 37 37 ); 38 $totalSize += $file['size']; 38 39 } 39 Controller::addFallbackHandler( 0, function($e){40 throw $e;41 } );42 40 43 $result = array(); 44 $attachments_ids = array(); 45 46 foreach($files as $key => $value){ 47 $value['disposition'] = isset($value['disposition']) ? 48 $value['disposition'] : 'attachment'; 49 try{ 50 $attachment = Controller::put( array( 'concept' => "mailAttachment" ), $value ); 51 $attachments_ids[] = $attachment[0]['id']; 41 $uploadMaxFileSize = str_replace("M","",$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024; 42 if($totalSize > $uploadMaxFileSize){ 43 Errors::runException("MAIL_NOT_SENT_LIMIT_EXCEEDED", $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']); 44 } 45 46 if($this->getExpressoVersion() != "2.2") 47 { 48 require_once (__DIR__.'/../../../prototype/api/controller.php'); 49 Controller::addFallbackHandler( 0, function($e){ 50 throw $e; 51 } ); 52 53 $result = array(); 54 $attachments_ids = array(); 52 55 53 }catch(Exception $e){ 54 $attachment['error'] = $e->getMessage(); 56 foreach($files as $key => $value){ 57 $value['disposition'] = isset($value['disposition']) ? 58 $value['disposition'] : 'attachment'; 59 try{ 60 $attachment = Controller::put( array( 'concept' => "mailAttachment" ), $value ); 61 $attachments_ids[] = $attachment[0]['id']; 62 }catch(Exception $e){ 63 Errors::runException($e->getMessage()); 64 } 55 65 } 66 $params['attDisposition1'] = 'attachment'; 67 $params['attachments'] = json_encode($attachments_ids); 56 68 } 57 58 $params['attDisposition1'] = 'attachment';59 $params['attachments'] = json_encode($attachments_ids);60 69 } 61 70 $returncode = $this->getImap()->send_mail($params);
Note: See TracChangeset
for help on using the changeset viewer.