From 6c0ea3a420f8e6c1f80beeac6e3ce9345f121fe3 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 10 Mar 2021 10:26:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=82=AE=E4=BB=B6=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Email.php | 3 ++- application/common/library/Log.php | 29 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 application/common/library/Log.php diff --git a/application/common/library/Email.php b/application/common/library/Email.php index 8d186fc3..7d934eca 100644 --- a/application/common/library/Email.php +++ b/application/common/library/Email.php @@ -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']); diff --git a/application/common/library/Log.php b/application/common/library/Log.php new file mode 100644 index 00000000..a9d891dc --- /dev/null +++ b/application/common/library/Log.php @@ -0,0 +1,29 @@ +