mail = new PHPMailer(true); $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'] ?? ''; } /** * @throws Exception */ public function send(string $address): void { $this->mail->setFrom($this->username, $this->host); $this->mail->addAddress($address); $this->mail->Subject = 'Код подтверждения'; $body = '

«Hello, world!»

'; $this->mail->msgHTML($body); $this->mail->send(); } }