Subversion Repositories SmartDukaan

Rev

Rev 14654 | Rev 18641 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14654 Rev 18638
Line 17... Line 17...
17
 */
17
 */
18
	public $components = array('Paginator');
18
	public $components = array('Paginator');
19
 
19
 
20
	public function beforeFilter() {
20
	public function beforeFilter() {
21
		parent::beforeFilter();
21
		parent::beforeFilter();
22
		$this->Auth->allow('add');
22
		$this->Auth->allow('add','crm_mail');
23
	}
23
	}
24
 
24
 
25
/**
25
/**
26
 * index method
26
 * index method
27
 *
27
 *
Line 221... Line 221...
221
			$this->Session->setFlash(__('The feedback has been deleted.'));
221
			$this->Session->setFlash(__('The feedback has been deleted.'));
222
		} else {
222
		} else {
223
			$this->Session->setFlash(__('The feedback could not be deleted. Please, try again.'));
223
			$this->Session->setFlash(__('The feedback could not be deleted. Please, try again.'));
224
		}
224
		}
225
		return $this->redirect(array('action' => 'index'));
225
		return $this->redirect(array('action' => 'index'));
226
	}}
226
	}
-
 
227
 
-
 
228
	public function crm_mail(){
-
 
229
		$this->log(print_r($this->request->data,1),'feedbacks');
-
 
230
		$this->loadModel('User');
-
 
231
		$this->User->recursive = -1;
-
 
232
		$user = $this->User->findById($this->request->data['user_id']);
-
 
233
		$emailConf = Configure::read('emailsCrm');
-
 
234
		$Email = new CakeEmail('smtp');
-
 
235
		$Email->from($emailConf['from']);
-
 
236
		$Email->to($emailConf['to']);
-
 
237
		$Email->cc($emailConf['cc']);
-
 
238
		$Email->subject('');
-
 
239
		$message = "User Id : ".$this->request->data['user_id']."\n\n";
-
 
240
		$message .= "Email : ".$user['User']['email']."\n\n";
-
 
241
		$message .= "Mobile : ".$user['User']['mobile_number']."\n\n";
-
 
242
		$message .= "Subject : ".$this->request->data['subject']."\n\n";
-
 
243
		$message .= "Message : ".$this->request->data['message']."\n\n";
-
 
244
		$Email->send($message);
-
 
245
	}
-
 
246
}