wesmiler 3 лет назад
Родитель
Сommit
c30fa611d4
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      app/Services/EmailService.php

+ 2 - 0
app/Services/EmailService.php

@@ -88,6 +88,7 @@ class EmailService extends BaseService
             $mail = new PHPMailer(true);
             $mail->CharSet ="UTF-8";                                         //设定邮件编码
             $mail->SMTPDebug = 0;                                            //调试模式输出:0 不输出,2 输出
+            $mail->Timeout = 20;                                            //超时
             $mail->isSMTP();                                                 //使用SMTP
             $mail->Host = $this->config['host'];                                     // SMTP服务器:以QQ为例
             $mail->SMTPAuth = true;                                          // 允许 SMTP 认证
@@ -107,6 +108,7 @@ class EmailService extends BaseService
             $mail->Body    = $template;     //邮件内容
             $mail->AltBody = "您的验证码是:{$code}";       //邮件内容:如果邮件客户端不支持HTML则显示此内容//*/
             $mail->send();
+            RedisService::set($cacheKey, ['email'=> $email, 'code'=> $code, 'date'=> date('Y-m-d H:i:s')], 300);
 
             return true;
         } catch (\Exception $exception){