diff --git a/kernel/helpers/SMTP.php b/kernel/helpers/SMTP.php index 4ca2f46..9abdf95 100644 --- a/kernel/helpers/SMTP.php +++ b/kernel/helpers/SMTP.php @@ -8,21 +8,17 @@ use PHPMailer\PHPMailer\PHPMailer; class SMTP { public PHPMailer $mail; - public string $host; - public int $port; - public string $username; - public string $password; - public function __construct(array $config = []) { $this->mail = new PHPMailer(true); + $this->mail->CharSet = 'UTF-8'; $this->mail->isSMTP(); $this->mail->SMTPAuth = true; $this->mail->SMTPDebug = 0; - $this->host = $config['host'] ?? ''; - $this->port = $config['port'] ?? 587; - $this->username = $config['username'] ?? ''; - $this->password = $config['password'] ?? ''; + $this->mail->Host = $config['host'] ?? ''; + $this->mail->Port = $config['port'] ?? 587; + $this->mail->Username = $config['username'] ?? ''; + $this->mail->Password = $config['password'] ?? ''; } /** @@ -30,7 +26,7 @@ class SMTP */ public function send(string $address): void { - $this->mail->setFrom($this->username, $this->host); + $this->mail->setFrom($this->mail->Username, $this->mail->Host); $this->mail->addAddress($address); $this->mail->Subject = 'Код подтверждения'; $body = '
«Hello, world!»
';