当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::sendMail方法代码示例

本文整理汇总了PHP中Helper::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::sendMail方法的具体用法?PHP Helper::sendMail怎么用?PHP Helper::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::sendMail方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $model = new ForgetPwdForm();
     if (isset($_POST['ForgetPwdForm'])) {
         $model->attributes = $_POST['ForgetPwdForm'];
         if ($model->validate()) {
             $safestr = $this->controller->_setting['safe_str'];
             //安全密匙
             $important_string = $model->id;
             $authcode = urlencode(Helper::authcode($important_string, 'ENCODE', $safestr, 600));
             //加密处理,10分钟内过期
             $authurl = Yii::app()->request->hostInfo . $this->controller->createUrl('resetPwd', array('authcode' => $authcode));
             $subject = Yii::t('common', 'Reset Pwd');
             $message = Yii::t('common', 'ResetPwd Email', array('{username}' => $model->username, '{sitename}' => $this->controller->_setting['site_name'], '{authurl}' => $authurl, '{admin_email}' => $this->controller->_setting['admin_email']));
             Helper::sendMail($model->id, $model->email, $subject, $message);
             $this->controller->message('success', Yii::t('common', 'Send ResetPwd Email Success'), $this->controller->createUrl('site/index'), 5);
         }
     }
     //set seo
     $this->controller->_seoTitle = Yii::t('common', 'Find Pwd') . ' - ' . $this->controller->_setting['site_name'];
     $this->controller->_seoKeywords = Yii::t('common', 'Find Pwd');
     $this->controller->_seoDescription = Yii::t('common', 'Find Pwd');
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->controller->_stylePath . "/css/user.css");
     Yii::app()->clientScript->registerScriptFile($this->controller->_static_public . "/js/jquery/jquery.js");
     $this->controller->render('forgetpwd', array('model' => $model));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:27,代码来源:ForgetPwdAction.php

示例2: run

 public function run()
 {
     $formModel = new ContactUsWidgetForm();
     if ($this->getEmailFromConnectedMember && isset($this->controller->memberModel->email)) {
         $formModel->email = $this->controller->memberModel->email;
     }
     if (isset($_POST['ContactUsWidgetForm']) && Yii::app()->request->isAjaxRequest) {
         $formModel->attributes = $_POST['ContactUsWidgetForm'];
         $valid = CActiveForm::validate($formModel);
         if ($valid == '[]') {
             $message = $this->controller->renderPartial($this->emailViewFile, array('message' => $formModel->message, 'email' => $formModel->email, 'personName' => $formModel->personName), true);
             if (Helper::sendMail($this->emailTo, $this->emailSubject, $message) !== true) {
                 echo "\n" . '<div id="contact-form-json">' . "\n";
                 echo CJSON::encode(array('status' => 'error'));
                 echo "\n" . '</div>' . "\n";
             } else {
                 echo "\n" . '<div id="contact-form-json">' . "\n";
                 echo CJSON::encode(array('status' => 'success'));
                 echo "\n" . '</div>' . "\n";
             }
             Yii::app()->end();
         } else {
             echo "\n" . '<div id="contact-form-json">' . "\n";
             echo $valid;
             echo "\n" . '</div>' . "\n";
             Yii::app()->end();
         }
     }
     $this->render('contactUsWidget', array('formModel' => $formModel));
 }
开发者ID:kostya1017,项目名称:our,代码行数:30,代码来源:ContactUsWidget.php

示例3: actionForgetpwd

 /**
  * 找回密码
  * 
  */
 public function actionForgetpwd()
 {
     $model = new ForgetPwdForm();
     if (isset($_POST['ForgetPwdForm'])) {
         $model->attributes = $_POST['ForgetPwdForm'];
         if ($model->validate()) {
             $safestr = $this->_setting['safe_str'];
             //安全密匙
             $important_string = $model->id;
             $authcode = Helper::authcode($important_string, 'ENCODE', $safestr, 600);
             //加密处理,10分钟内过期
             $authcode = urlencode($authcode);
             //url编码
             $authurl = $this->_request->hostInfo . $this->createUrl('resetPwd', array('authcode' => $authcode));
             $subject = Yii::t('common', 'Reset Pwd');
             $message = Yii::t('common', 'ResetPwd Email', array('{username}' => $model->username, '{sitename}' => $this->_setting['site_name'], '{authurl}' => $authurl, '{admin_email}' => $this->_setting['admin_email']));
             Helper::sendMail($model->id, $model->email, $subject, $message);
             $this->message('success', Yii::t('common', 'Send ResetPwd Email Success'), $this->createUrl('forgetpwd'), 5);
         }
     }
     //set seo
     $this->_seoTitle = Yii::t('common', 'Find Pwd') . ' - ' . $this->_setting['site_name'];
     $this->_seoKeywords = Yii::t('common', 'Find Pwd');
     $this->_seoDescription = Yii::t('common', 'Find Pwd');
     $this->render('forgetpwd', array('model' => $model));
 }
开发者ID:github-zjh,项目名称:task,代码行数:30,代码来源:UserController.php

示例4: run

 public function run()
 {
     if (Yii::app()->request->isPostRequest && $_POST['ajax'] == 1) {
         $toemail = $_POST['toemail'];
         if (Helper::sendMail('', $toemail, Yii::t('admin', 'Test Email Subject'), Yii::t('admin', 'Test Email Content'))) {
             exit(CJSON::encode(array('state' => 'success')));
         } else {
             exit(CJSON::encode(array('state' => 'failed')));
         }
     } else {
         exit(CJSON::encode(array('state' => 'failed')));
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:13,代码来源:TestEmailAction.php

示例5: sendActiveAccount

 /**
  * 发送账号激活邮件
  * @param unknown $params
  */
 public function sendActiveAccount($params = array())
 {
     //生成校验字符串
     if (!$params['id'] || !$params['username'] || !$params['email']) {
         return false;
     }
     $safestr = $this->_setting['safe_str'];
     //安全密匙
     $important_string = $params['id'];
     $authcode = urlencode(Helper::authcode($important_string, 'ENCODE', $safestr, 3600 * 2));
     //加密处理,2个小时过期
     $authurl = Yii::app()->request->hostInfo . $this->createUrl('authEmail', array('authcode' => $authcode));
     $subject = Yii::t('common', 'Account Active');
     $message = Yii::t('common', 'Register Email', array('{username}' => $params['username'], '{sitename}' => $this->_setting['site_name'], '{authurl}' => $authurl, '{admin_email}' => $this->_setting['admin_email']));
     Helper::sendMail(0, $params['email'], $subject, $message);
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:20,代码来源:UserController.php

示例6: renderContent

 protected function renderContent()
 {
     $member = new Member();
     $member->scenario = 'newAccountForm';
     if (isset($_GET['ahash'])) {
         if (($existingMember = Member::model()->findByAttributes(array('activation_hash' => $_GET['ahash']))) && $existingMember->activation_time >= date('Y-m-d H:i:s', strtotime('-1 day'))) {
             $existingMember->activation_hash = '';
             $existingMember->activation_time = null;
             $existingMember->save();
             $originalLayout = $this->controller->layout;
             $this->controller->layout = '//layouts/email';
             $to = $existingMember->email;
             $subject = Yii::t('memberModule.common', 'Bienvenue');
             $body = $this->controller->render('member.components.views.emailWelcome', array(), true);
             $this->controller->layout = $originalLayout;
             Helper::sendMail($to, $subject, $body);
             // Login user
             Yii::app()->authManager->assign('Member', 'Member-' . $existingMember->id);
             $identity = new MemberIdentity($existingMember->email, '');
             $identity->authenticate(true);
             Yii::app()->user->login($identity, 0);
             $this->controller->redirect($this->controller->createUrl('/member/default/account', array('new' => 1)));
         } else {
             $this->controller->redirect($this->controller->createUrl('/site/index', array('message' => 'newaccountexpired')));
         }
     }
     if (isset($_POST['Member'])) {
         if ($existingMember = Member::model()->findByAttributes(array('email' => $_POST['Member']['email']), "activation_hash <> ''")) {
             $member = $existingMember;
         }
         $member->scenario = 'newAccountForm';
         $member->attributes = $_POST['Member'];
         $member->activation_hash = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 32);
         $member->activation_time = date('Y-m-d H:i:s');
         if ($member->save()) {
             $originalLayout = $this->controller->layout;
             $this->controller->layout = '//layouts/email';
             $to = $member->email;
             $subject = Yii::t('memberModule.common', 'Votre nouveau compte a besoin d’être activé');
             $body = $this->controller->render('member.components.views.emailActivation', array('member' => $member), true);
             $this->controller->layout = $originalLayout;
             Helper::sendMail($to, $subject, $body);
             $this->controller->redirect($this->controller->createUrl('/site/index', array('message' => 'newaccount')));
         }
     }
     $this->render('newAccountFormWidget', array('member' => $member));
 }
开发者ID:kostya1017,项目名称:our,代码行数:47,代码来源:NewAccountFormWidget.php

示例7: _sendEmailVerifyCode

 /**
  * 发送邮箱验证码
  * 
  * @param object $model
  * @return json
  */
 private function _sendEmailVerifyCode($user_model, $model)
 {
     if ($model->validate()) {
         if ($this->controller->_active_need) {
             $acceptCaptcha = Yii::app()->session[$model->newEmail . '_captcha'] = substr(mt_rand(0, time()), 2, 6);
             $subject = Yii::t('common', 'Reset Email Subject');
             $message = Yii::t('common', 'Reset Email Content', array('{username}' => $user_model->username, '{email_captcha}' => $acceptCaptcha, '{admin_email}' => $this->controller->_setting['admin_email']));
             Helper::sendMail($model->uid, $model->newEmail, $subject, $message);
         }
         exit(CJSON::encode(array('status' => 'success', 'message' => Yii::t('common', 'Send Success'))));
     } else {
         $errors = $model->getErrors();
         foreach ($errors as $error) {
             $msg = reset($error);
             break;
         }
         exit(CJSON::encode(array('status' => 'error', 'message' => $msg)));
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:25,代码来源:SettingEmailAction.php

示例8: actionDetail

 public function actionDetail($n, $confirmation = 0)
 {
     if (Yii::app()->user->getState('siteVersion') == 'mobile') {
         Yii::app()->clientScript->registerCssFile('/css/mobile/blocs.css');
         $this->layout = '//mobileLayouts/column1';
     }
     if (!($contest = Contest::model()->with(array('fields' => array('order' => 'fields.rank ASC'), 'fields.multi' => array('order' => 'multi.rank ASC')))->find('i18nContest.l_title_url=:n', array('n' => $n)))) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     $currentDate = date('Y-m-d H:i:s');
     $contestMultilang = Contest::model()->multilang()->find('i18nContest.l_title_url=:n', array('n' => $n));
     Yii::app()->languageManager->translatedGetVars['n'] = array();
     foreach (array_keys(Yii::app()->languageManager->languages) as $language) {
         Yii::app()->languageManager->translatedGetVars['n'][$language] = $contestMultilang->{'title_url_' . $language};
     }
     // In case detail page is accessed directly and contest is inactive.
     if ($contest->status == "inactive") {
         $this->redirect($this->createUrl('index'));
     }
     if ($confirmation) {
         $this->render('confirmation', array('contest' => $contest));
     } elseif ($contest->end_date !== null && $contest->end_date < $currentDate || $contest->status == "archived") {
         $this->render('conclusion', array('contest' => $contest));
     } else {
         $entry = new EntryForm();
         $validators = $entry->getValidatorList();
         $required = 'verify_code, ';
         $files = '';
         $length = '';
         $email = '';
         $entry->verify_code = null;
         $entry->attributeLabels['verify_code'] = Yii::t('contestModule.common', 'Code de sécurité');
         $validators->add(CValidator::createValidator('captcha', $this, 'verify_code', array('message' => Yii::t('contestModule.common', 'Le code saisi est invalide. Veuillez entrer le code à nouveau.'), 'allowEmpty' => !CCaptcha::checkRequirements(), 'captchaAction' => '/site/captcha')));
         foreach ($contest->fields as $field) {
             $entry->{$field->id} = null;
             $entry->attributeLabels[$field->id] = CHtml::encode($field->title);
             if ($field->required) {
                 $required .= $field->id . ', ';
             }
             $length .= $field->id . ', ';
             if ($field->type == 'email') {
                 $email .= $field->id . ', ';
             }
             if ($field->type == 'file') {
                 $files = $field->id . ', ';
                 $behaviors = array('class' => 'application.models.behaviors.UploadingBehavior.ModelUploadingBehavior', 'attribute' => $field->id, 'dir' => 'files/_user/contest_entries', 'tempDir' => 'files/_user/contest_entries/_temp', 'cacheTime' => 10 * 24 * 60 * 60, 'uploadcare' => null, 'allowDelete' => false);
                 $entry->{$field->id . 'Handler'} = $entry->attachBehavior($field->id . 'Handler', $behaviors);
                 $entry->behaviors = array($behaviors);
             }
         }
         if ($required != '') {
             $validators->add(CValidator::createValidator('required', $this, substr($required, 0, -2)));
         }
         if ($length != '') {
             $validators->add(CValidator::createValidator('length', $this, substr($length, 0, -2), array('max' => 1000)));
         }
         if ($email != '') {
             $validators->add(CValidator::createValidator('email', $this, substr($email, 0, -2)));
         }
         if ($files != '') {
             $validators->add(CValidator::createValidator('file', $this, substr($files, 0, -2), array('allowEmpty' => true)));
         }
         if (isset($_POST['EntryForm'])) {
             foreach ($_POST['EntryForm'] as $id => $attribute) {
                 if (is_array($attribute)) {
                     $entry->{$id} = serialize($attribute);
                 } else {
                     $entry->{$id} = $attribute;
                 }
             }
             if ($entry->validate()) {
                 $entryModel = new ContestEntry();
                 $entryModel->contest_id = $contest->id;
                 $entryModel->ip = $_SERVER['REMOTE_ADDR'];
                 $entryModel->save();
                 foreach ($contest->fields as $field) {
                     if ($field->type == 'checkbox') {
                         $entry->{$field->id} = unserialize($entry->{$field->id});
                     }
                     if (is_array($entry->{$field->id})) {
                         foreach ($entry->{$field->id} as $entryValue) {
                             $model = new ContestEntryItem();
                             $model->contest_entry_id = $entryModel->id;
                             $model->contest_field_id = $field->id;
                             $model->content = $entryValue;
                             $model->save();
                         }
                     } else {
                         $model = new ContestEntryItem();
                         $model->contest_entry_id = $entryModel->id;
                         $model->contest_field_id = $field->id;
                         $model->content = $entry->{$field->id};
                         $model->save();
                     }
                 }
                 if ($contest->send_notification_email == 1) {
                     $message = $this->renderPartial('_notificationEmail', array('entry' => $entryModel, 'contest' => $contest), true);
                     Helper::sendMail($this->module->notificationEmail, 'Nouvelle participation à "' . CHtml::encode($contest->title) . '"', $message);
                 }
                 $this->redirect(array('detail', 'n' => $n, 'confirmation' => 1));
//.........这里部分代码省略.........
开发者ID:kostya1017,项目名称:our,代码行数:101,代码来源:DefaultController.php

示例9: actionDetail

    public function actionDetail($t, $cvFormSuccess = null)
    {
        if (Yii::app()->user->getState('siteVersion') == 'mobile') {
            Yii::app()->clientScript->registerCssFile('/css/mobile/blocs.css');
            $this->layout = '//mobileLayouts/column1';
        }
        if (!is_dir('files/_user/job')) {
            mkdir('files/_user/job');
        }
        if (!is_dir('files/_user/job/cv')) {
            mkdir('files/_user/job/cv');
        }
        $this->sidebarViewFile = '/layouts/_sidebar';
        if (!($job = Job::model()->find('i18nJob.l_title_url=:t', array('t' => $t)))) {
            throw new CHttpException(404, 'The requested page does not exist.');
        }
        $jobMultilang = Job::model()->multilang()->find('i18nJob.l_title_url=:t', array('t' => $t));
        Yii::app()->languageManager->translatedGetVars['t'] = array();
        foreach (array_keys(Yii::app()->languageManager->languages) as $language) {
            Yii::app()->languageManager->translatedGetVars['t'][$language] = $jobMultilang->{'title_url_' . $language};
        }
        $this->sidebarData['currentJobId'] = $job->id;
        // Pour identification de l'emploi actuellement affiché.
        $this->sidebarData['jobs'] = Job::model()->findAll(array('condition' => 'category_id=:category_id AND active = 1', 'order' => 'title ASC', 'params' => array(':category_id' => $job->category_id)));
        $modelCv = new JobCv();
        if (isset($_POST['JobCv'])) {
            $modelCv->attributes = $_POST['JobCv'];
            $modelCv->date = date('Y-m-d h:i:s');
            if ($modelCv->save()) {
                Yii::app()->db->createCommand('INSERT INTO job_job_cv (job_id, job_cv_id) VALUES (:job_id, :job_cv_id)')->execute(array(':job_id' => $job->id, ':job_cv_id' => $cvModel->id));
                $subject = 'Postulation pour l’offre d’emploi ' . CHtml::encode($job->title);
                $body = '
				<p>Bonjour,<br/><br/>
				Vous avez reçu une postulation pour le poste cité en objet.<br/><br/>
				<a href="http://' . $_SERVER['HTTP_HOST'] . '/files/_user/jobcv/' . Helper::encodeFileName($modelCv->cv) . '" title="Cliquez ici pour télécharger le curriculum vitae">Cliquez ici pour télécharger le curriculum vitae</a></p>
				';
                if (($mailerError = Helper::sendMail($this->module->cvEmail, $subject, $body)) !== true) {
                    throw new CHttpException(500, $mailerError);
                }
                $this->redirect($this->createUrl('detail', array('cvFormSuccess' => 1, 't' => $t)) . "#msg");
            }
        }
        $this->render('detail', array('job' => $job, 'modelCv' => $modelCv, 'cvFormSuccess' => $cvFormSuccess));
    }
开发者ID:kostya1017,项目名称:our,代码行数:44,代码来源:DefaultController.php


注:本文中的Helper::sendMail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。