<?php
/* Spamschutz */
if ($_POST["confirm"]) {
 echo "Dieses Kontaktformular verschickt nur Nachrichten von Menschen ...";
 exit;
}
?>

<?php
// MAILSCRIPT MIT HTML+EXCEPTIONS
// PHPMAILER 6
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require "vendor/PHPMailer-6.2.0/src/PHPMailer.php";
require "vendor/PHPMailer-6.2.0/src/Exception.php";

// enable exceptions 'true'
$mail = new PHPMailer(true);
try {
    //Recipients
    $mail->setFrom($_POST["email"], $_POST["name"]);
    $mail->addAddress('mail@nucom.at', 'NUCOM MEDIA');
    // $mail->addAddress('ellen@example.com');
    // $mail->addReplyTo('info@example.com', 'Information');
    // $mail->addCC('cc@example.com');
    // $mail->addBCC('bcc@example.com');

    //Content
    $mail->isHTML(true);
	//$body = 'Email from '.$cname;
	//$body .= '<br><br>'.$body;
	//$body .= '<br><br>Address: '.$addr.'<br>'.$venue.'<br>Time: '.$time.'<br>Date: '.$date.'<br>Contact Person: '.$pname.'<br>Contact No: '.$cno;
	//$mail->Subject = 'Email from SNG';
	//$mail->Body  = $body;
    $mail->Subject = 'Here is the subject';
    $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
	
	//Attachments
	$mail->AddAttachment($_FILES['file']['tmp_name'],$_FILES['file']['name']);
	// Validation,Filesize

    $mail->send();
    echo 'Nachricht erfolgreich gesendet!';
} catch (Exception $e) {
    echo 'Nachricht konnte nicht gesendet werden. Fehler: ', $mail->ErrorInfo;}
?>