reinit here include(__DIR__ . "/config.php"); $mail = new PHPMailer(true); try { $mail->CharSet = 'utf-8'; // Enable utf-8 support for umlauts $mail->SMTPDebug = 2; // Enable verbose debug output if (is_array($config["smtp"])) { $smtp_conf = $config["smtp"]; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = $smtp_conf["host"]; // Specify main and backup SMTP servers $mail->Port = $smtp_conf["port"]; // TCP port to connect to if (isset($smtp_conf["user"])) { $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $smtp_conf["user"]; // SMTP username if (isset($smtp_conf["password"])) { $mail->Password = $smtp_conf["password"]; // SMTP password } } $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted } else { // fallback to sendmail functionality (as before) $mail->isSendmail(); } //Recipients $mail->setFrom($config["register_email"], 'Register Service'); $mail->addAddress($receiver); $mail->Subject = $subject; $mail->Body = $body; $mail->send(); return True; } catch (Exception $e) { error_log('Message could not be sent. Mailer Error: ' . $mail->ErrorInfo); return False; } } $lang = $config["defaultLanguage"]; if (isset($_GET['lang'])) { $lang = filter_var($_GET['lang'], FILTER_SANITIZE_STRING); } $lang_file = __DIR__ . "/lang/mail." . $lang . ".php"; if (!file_exists($lang_file)) { error_log("Mail templates for '" . $lang . "' not found. Fallback to 'de-de'"); $lang = "de-de"; } $lang_file = __DIR__ . "/lang/mail." . $lang . ".php"; require_once($lang_file); unset($lang_file); ?>