Example #1
0
 public function sendAccActivationEmail()
 {
     $owner = $this->getOwner();
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_ACCOUNT_ACTIVATION));
     if (empty($template)) {
         return FALSE;
     }
     $site_name = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name);
     //placeholders: {name},{link},
     $body = Common::myStringReplace($template['body'], array('{name}' => $owner->username, '{link}' => Yii::app()->createAbsoluteUrl('auth/default/activate', array('id' => $owner->id, 'token' => $owner->activation_code))));
     MsgEmailOutbox::model()->push(array('from_name' => $site_name, 'from_email' => $template['from'], 'to_email' => $owner->email, 'subject' => $template['subject'], 'message' => $body));
 }
Example #2
0
 public function sendEmail()
 {
     $this->user_model->password_reset_code = Common::generateSalt();
     $this->user_model->password_reset_request_date = date('Y-m-d H:i:s');
     $this->user_model->save(false);
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_FORGOT_PASSWORD));
     if (empty($template)) {
         return FALSE;
     }
     //placeholders : {name},{link}
     $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($this->user_model->id, 'CONCAT(first_name," ",last_name)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/resetPassword', array('id' => $this->user_model->id, 'token' => $this->user_model->password_reset_code))));
     //$from, $this->user_model->email, $template->title, $template->body, true
     MsgEmailOutbox::model()->push(array('from_name' => Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name), 'from_email' => $template['from'], 'to_email' => $this->user_model->email, 'subject' => $template['subject'], 'message' => $body));
 }
 /**
  * Lists all.
  */
 public function actionIndex()
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t('Manage ' . $this->resourceLabel);
     $this->render('index', array('model' => SettingsEmailTemplate::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'id')));
 }