CharSet = 'utf-8'; $mail->SMTPDebug = 2; $mail->isSMTP(); $mail->Debugoutput = function($str, $level) { // Debug-Ausgabe in Datei schreiben file_put_contents(__DIR__ . '/phpmailer_debug.log', date('Y-m-d H:i:s') . " [Level $level] $str\n", FILE_APPEND); }; if ($develop == 'true') { $mail->Host = 'mailhog'; $mail->Port = 1025; } else { $mail->SMTPAuth = true; $mail->Host = "mail.gmx.de"; $mail->Port = "587"; $mail->SMTPSecure = "tls"; $mail->Username = "sternwarte.welzheim@gmx.de"; $mail->Password = "4NT&%nH9&5wz"; } $mail->setFrom("sternwarte.welzheim@gmx.de", 'Sternwarte-Welzheim'); if (count($to) != 0) { foreach ($to as $t) { $mail->addAddress($t); } } $mail->Subject = $subject; $mail->Body = $body; if (count($cc) != 0) { foreach ($cc as $c) { $mail->addCC($c); } } if(count($bcc) != 0) { foreach ($bcc as $bc) { $mail->addBCC($bc); } } $mail->addReplyTo($from); $mail->send(); $ret ['oktext'] = 'Mail erfolgreich versendet'; } catch (Exception $e) { $ret['error'] = true; $ret['errortext'] = $mail->ErrorInfo; } return $ret; } ?>