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


PHP UserMailer::mail方法代码示例

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


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

示例1: resetPassword

 public function resetPassword()
 {
     if ($this->request()->isPost()) {
         $user = User::find_by_name($this->params()->user['name']);
         if ($user) {
             $new_password = $user->reset_password();
             $this->notice('Password reset to ' . $new_password);
             if ($user->email) {
                 // try {
                 UserMailer::mail('new_password', [$user, $new_password])->deliver();
                 // } catch (\Exception $e) {
                 // $this->respond_to_success("Specified user's email address was invalid",
                 // ['#reset_password'], ['api' => ['result' => 'invalid-email']]);
                 // return;
                 // }
             }
         } else {
             $this->notice('That account does not exist');
             $this->redirectTo('#reset_password');
         }
     } else {
         $this->user = new User();
     }
 }
开发者ID:JCQS04,项目名称:myimouto,代码行数:24,代码来源:AdminController.php

示例2: resetPassword

 public function resetPassword()
 {
     $this->set_title('Reset Password');
     if ($this->request()->isPost()) {
         $this->user = User::where(['name' => $this->params()->user['name']])->first();
         if (!$this->user) {
             $this->respond_to_error("That account does not exist", '#reset_password', ['api' => ['result' => "unknown-user"]]);
             return;
         }
         if (!$this->user->email) {
             $this->respond_to_error("You never supplied an email address, therefore you cannot have your password automatically reset", '#login', ['api' => ['result' => "no-email"]]);
             return;
         }
         if ($this->user->email != $this->params()->user['email']) {
             $this->respond_to_error("That is not the email address you supplied", '#login', ['api' => ['result' => "wrong-email"]]);
             return;
         }
         # iTODO:
         try {
             // User.transaction do
             # If the email is invalid, abort the password reset
             $new_password = $this->user->reset_password();
             UserMailer::mail('new_password', [$this->user, $new_password])->deliver();
             $this->respond_to_success("Password reset. Check your email in a few minutes.", '#login', ['api' => ['result' => "success"]]);
             return;
             // end
         } catch (Exception $e) {
             // rescue Net::SMTPSyntaxError, Net::SMTPFatalError
             $this->respond_to_success("Your email address was invalid", '#login', ['api' => ['result' => "invalid-email"]]);
             return;
         }
     } else {
         $this->user = new User();
         if ($this->params()->format and $this->params()->format != 'html') {
             $this->redirectTo('root');
         }
     }
 }
开发者ID:JCQS04,项目名称:myimouto,代码行数:38,代码来源:UserController.php


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