<?php
session_start();
error_reporting(0);
ini_set("display_errors", false);
$mail = $_SESSION['formdata']['email'];
$anrede = $_SESSION['formdata']['anrede'];
$vorname = $_SESSION['formdata']['vorname'];
$nachname = $_SESSION['formdata']['nachname'];
$thema = $_SESSION['formdata']['thema'];
echo $mail .'<br />';
echo $anrede .'<br />';
echo $vorname .'<br />';
echo $nachname .'<br />';
echo $thema .'<br />';
class language {
public $data;
function __construct($language) {
$data = file_get_contents($language . ".json");
$this->data = json_decode($data);
}
function translate() {
return $this->data;
}
}
$sprache = $lang;
$language = new language($sprache);
$lang = $language->translate();
$anrede_frau = $lang->Form_Danke->Satz1;
$anrede_herr = $lang->Form_Danke->Satz2;
$anrede2 = $anrede;
switch ($anrede2)
{
case "Frau":
$anrede2 = "$anrede_frau $vorname $nachname";
break;
case "Herr":
$anrede2 = "$anrede_herr $vorname $nachname";
break;
default:
$anrede2 = "";
}
$zeile16 = $lang->Kontakt_email->zeile16;
$zeile17 = $lang->Kontakt_email->zeile17;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require __DIR__ . "/PHPMailer/src/Exception.php";
require __DIR__ . "/PHPMailer/src/PHPMailer.php";
require __DIR__ . "/PHPMailer/src/SMTP.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$mail = $_SESSION['formdata']['email'];
$anrede = $_SESSION['formdata']['anrede'];
$vorname = $_SESSION['formdata']['vorname'];
$nachname = $_SESSION['formdata']['nachname'];
$thema = $_SESSION['formdata']['thema'];
$dankeSeite = "danke.php";
$fehlerSeite = "fehler.php";
$mail = new PHPMailer(true);
$mail->CharSet = "UTF-8";
$mail->IsHTML(true);
$mail->isSMTP();
$mail->Host = "xxxx";
$mail->SMTPAuth = true;
$mail->Username = "xxxx";
$mail->Password = "xxxx";
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
$mail->setFrom("xx@xxxxxx.com", "xxxx");
$mail->addAddress($mail, $nachname);
$mail->addReplyTo($mail, $nachname);
$mail->AddBCC("xx@xxxxxx.com", "xxxx");
$mail->Subject = $thema;
$jetzt = date_create("now", timezone_open("Europe/Berlin"));
$datum = date_format($jetzt, "d.m.Y \u\m H:i");
$Inhalt = '
<img src="https://xxxx/images/logo/Logo_gross_text_tranparent.png" width="300" alt="CreativPur"/>
<hr />
<br /><br />
'.$anrede2.',
<br /><br />
sie haben uns am '.$datum.' Uhr zum Thema <strong>'. $thema.'</strong> folgende Anfrage zukommen lassen.
<br /><br />
'.$thema.'
<br /><br />
Wir werden uns Zeitnahe bei Ihnen wieder melden.
<br /><br />
Mit freundlichem Gruß
<br />
<i>Hansjörg Silberschlag</i>
<br /><br />
<br /><hr /><br />
<img src="https://xxxx/images/logo/Logo_gross_text_tranparent.png" width="150" alt="CreativPur"/>';
$mail->Body = $Inhalt;
if ($mail->send()) {
header("Location: " . $dankeSeite);
exit;
} else {
header("Location: " . $fehlerSeite);
exit;
}
}
?>