$value) {
if (!in_array($key, ['captcha','captcha_result','website'])) {
$rows .= "
|
" . ucfirst($key) . "
|
" . htmlspecialchars($value) . "
|
";
}
}
return "
Neue Fotobox Anfrage
Thies Mueller Service Solutions
Schwarzenbergstr. 70, 21073 Hamburg
Ust.ID: DE340124938
";
}
function sendMail($data, $config) {
$mail = new PHPMailer(true);
$mail->CharSet = 'UTF-8';
$mail->isSMTP();
$mail->Host = $config['smtp_host'];
$mail->SMTPAuth = true;
$mail->Username = $config['smtp_user'];
$mail->Password = $config['smtp_pass'];
$mail->SMTPSecure = 'tls';
$mail->Port = $config['smtp_port'];
$mail->setFrom($config['from'], $config['from_name']);
$html = buildHtmlMail($data);
$mail->addAddress($config['receipient']);
$mail->addReplyTo($data['email']);
$mail->isHTML(true);
$mail->Subject = 'Neue Fotobox Anfrage';
$mail->Body = $html;
$mail->AltBody = strip_tags($html);
$mail->send();
$mail->clearAddresses();
$mail->clearReplyTos();
$mail->addAddress($data['email']);
$mail->addReplyTo($config['receipient']);
$mail->Subject = 'Deine Anfrage bei'.$config['company_name'];
$mail->Body = "
Danke für deine Anfrage
Wir haben deine Anfrage erhalten und melden uns zeitnah.
$html
";
$mail->AltBody = 'Danke für deine Anfrage';
$mail->send();
}
$status = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['website'])) {
die('Spam erkannt');
}
if ($_POST['captcha'] != $_POST['captcha_result']) {
$status = 'error';
} else {
try {
sendMail($_POST, $config);
header('Location: success.html');
exit;
} catch (Exception $e) {
$status = 'error';
}
}
}
?>
Fehler
Fehler beim Senden
Zurück