<?php
/* Spamschutz */
if ($_POST["confirm"]) {
 echo "Dieses Kontaktformular verschickt nur Nachrichten von Menschen ...";
 exit;
}
?>

<?php
/* PHPMailer multiple files upload and send example */
//Import the PHPMailer class into the global namespace
use PHPMailer\PHPMailer\PHPMailer;
require "vendor/PHPMailer-6.2.0/src/PHPMailer.php";
    $mail = new PHPMailer;
	
	// Inhalt (Betreff optional)
	$inhalt = "Gesendet am: $datum Uhr
	BETREFF: " . $_POST["subject"] . "
	NAME: " . $_POST["name"] . "
	E-MAIL: " . $_POST["email"] . "
	TELEFON: " . $_POST["phone"] . "
	NACHRICHT: " . $_POST["message"] . "
	=================================
	WEBSITE: " . $_POST["url"] . "
	BRANCHE: " . $_POST["branch"] . "
	USP: " . $_POST["usp"] . "
	INTERESSE: " . $_POST["plan"] . "
	INHALTE: " . $_POST["cont"] . "
	BUDGET: " . $_POST["budget"] . "
	TERMIN: " . $_POST["date"] . "
	FAVORITEN: " . $_POST["favs"] . "
	";
	
	// Create a message
    $mail->setFrom($_POST["email"], $_POST["name"]);
    $mail->addAddress('mail@nucom.at','Nucom Media');
    $mail->Subject = 'Anfrage von Nucom.at';
	// $mail->Subject($_POST["subject"]);
	//Attachments
	if(is_array($_FILES)) {
	$mail->AddAttachment($_FILES['file']['tmp_name'],$_FILES['file']['name']);}
	$mail->Body = $inhalt;
	//$mail->IsHTML(false);
	
	// E-Mail versenden
	if ($mail->Send()) {
		header("Location: " . "danke.htm");}
	else {
		header("Location: " . "fehler.htm");}
}
?>