修复邮件发送错误

pull/288/MERGE
Karson 2021-03-10 10:26:54 +08:00
parent b909c0b27a
commit 6c0ea3a420
2 changed files with 31 additions and 1 deletions

View File

@ -62,7 +62,8 @@ class Email
$secureArr = [0 => '', 1 => 'tls', 2 => 'ssl'];
$secure = isset($secureArr[$this->options['mail_verify_type']]) ? $secureArr[$this->options['mail_verify_type']] : '';
$this->mail = new Mailer();
$logger = isset($this->options['debug']) && $this->options['debug'] ? new Log : null;
$this->mail = new Mailer($logger);
$this->mail->setServer($this->options['mail_smtp_host'], $this->options['mail_smtp_port'], $secure);
$this->mail->setAuth($this->options['mail_from'], $this->options['mail_smtp_pass']);

View File

@ -0,0 +1,29 @@
<?php
namespace app\common\library;
use Psr\Log\AbstractLogger;
use think\Hook;
/**
* 日志记录类
*/
class Log extends AbstractLogger
{
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param mixed[] $context
*
* @return void
*
* @throws \Psr\Log\InvalidArgumentException
*/
public function log($level, $message, array $context = array())
{
\think\Log::write($message);
}
}