[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Settings_Vtiger_OutgoingServer_Model extends Settings_Vtiger_Systems_Model { 12 13 private $defaultLoaded = false; 14 15 16 public function getSubject() { 17 return 'Test mail about the mail server configuration.'; 18 } 19 20 public function getBody() { 21 $currentUser = Users_Record_Model::getCurrentUserModel(); 22 return 'Dear '.$currentUser->get('user_name').', <br><br><b> This is a test mail sent to confirm if a mail is 23 actually being sent through the smtp server that you have configured. </b><br>Feel free to delete this mail. 24 <br><br>Thanks and Regards,<br> Team vTiger <br><br>'; 25 } 26 27 public function loadDefaultValues() { 28 $defaultOutgoingServerDetails = VtigerConfig::getOD('DEFAULT_OUTGOING_SERVER_DETAILS'); 29 foreach ($defaultOutgoingServerDetails as $key=>$value){ 30 $this->set($key,$value); 31 } 32 $this->defaultLoaded = true; 33 } 34 35 /** 36 * Function to get CompanyDetails Menu item 37 * @return menu item Model 38 */ 39 public function getMenuItem() { 40 $menuItem = Settings_Vtiger_MenuItem_Model::getInstance('LBL_MAIL_SERVER_SETTINGS'); 41 return $menuItem; 42 } 43 44 public function getEditViewUrl() { 45 $menuItem = $this->getMenuItem(); 46 return '?module=Vtiger&parent=Settings&view=OutgoingServerEdit&block='.$menuItem->get('blockid').'&fieldid='.$menuItem->get('fieldid'); 47 } 48 49 public function getDetailViewUrl() { 50 $menuItem = $this->getMenuItem(); 51 return '?module=Vtiger&parent=Settings&view=OutgoingServerDetail&block='.$menuItem->get('blockid').'&fieldid='.$menuItem->get('fieldid'); 52 } 53 54 public function isDefaultSettingLoaded() { 55 return $this->defaultLoaded; 56 } 57 58 public function save($request){ 59 vimport('~~/modules/Emails/mail.php'); 60 $currentUser = Users_Record_Model::getCurrentUserModel(); 61 62 $from_email = $request->get('from_email_field'); 63 $to_email = getUserEmailId('id',$currentUser->getId()); 64 65 $subject = $this->getSubject(); 66 $description = $this->getBody(); 67 // This is added so that send_mail API will treat it as user initiated action 68 $olderAction = $_REQUEST['action']; 69 $_REQUEST['action'] = 'Save'; 70 if($to_email != ''){ 71 $mail_status = send_mail('Users',$to_email,$currentUser->get('user_name'),$from_email,$subject,$description,'','','','','',true); 72 } 73 $_REQUEST['action'] = $olderAction; 74 if($mail_status != 1 && !$this->isDefaultSettingLoaded()) { 75 throw new Exception('Error occurred while sending mail'); 76 } 77 return parent::save(); 78 } 79 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |