'; } $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" . 'From: ' . $from . "\r\n" . 'Reply-To: ' . $from . "\r\n" . 'X-Mailer: PHP/' . phpversion(); return mail($to, $subject, $message, $headers); } public static function sendMail(string $subject, string $message, string $to = '', string $from = ''): bool { if ($to == '') { $to = self::$to; } if ($from == '') { $from = self::$name; } if (empty(self::$host) || empty(self::$port) || empty(self::$username) || empty(self::$password) || empty($to)) { return false; } $result = (new Mailer()) ->setServer(self::$host, self::$port, "tlsv1.2") ->setAuth(self::$username, self::$password) ->setFrom($from, self::$username) ->addTo('', $to) ->setSubject($subject) ->setBody($message) ->send(); return $result; } } Mail::_init();