<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

include_once __DIR__ . '/PHPMailer/PHProcksAutoloader.php';

if ($bereich == "Gem. Gerätewart"){
  $mail_kontakt="nils.bonk@googlemail.com";
}
else {
  $mail_kontakt="support@f-invent.de";
}


$subject = "#$ticketnr - $bereich - $name_wehr";

$oMailer = new PHPMailer;
$oMailer->CharSet = 'UTF-8';

$erstellt = date("d.m.Y - H:i:s");
$text1 = "<img width='200' height='50' src='http://cloud.f-invent.de/img/fi_text.svg'>";
$text1.= "<br><br><br><br>";
$text1.= "Von: $vorname $nachname - $name_wehr - $name_gemeinde";
$text1.= "<br><br>";
$text1.= "<b>Ticket:</b> #$ticketnr";
$text1.= "<br><br>";
$text1.= "Anfrage für: <b>$bereich</b>";
$text1.= "<br>";
$text1.= "<br>";
$text1.= "<b>Text:</b>";
$text1.= "<br><br>$text";
$text1.= "<br>";
$text1.= "<br>";


$oMailer->isSMTP();
$oMailer->Host = 'mail.f-invent.de';
$oMailer->SMTPAuth = true;
$oMailer->Username = 'noreply@f-invent.de';
$oMailer->Password = 'b*Y!@Ys.aKS^';
$oMailer->SMTPSecure = 'tls';
$oMailer->Port = 587;

$oMailer->From = 'noreply@f-invent.de';
$oMailer->FromName = 'Kontakt | F-Invent.de';
$oMailer->addBCC('support@f-invent.de', 'Support');
$oMailer->addAddress($mail_kontakt);
$oMailer->addReplyTo($email);

$oMailer->isHTML( true );
$oMailer->Subject = $subject;
$oMailer->Body = $text1;

$oMailer->AltBody = strip_tags( $oMailer->Body );


if ( !$oMailer->send() ) {

    echo 'Something\'s went wrong!';
    exit;

}

//echo 'Yes! First Mail with PHPMailer sent successfully!';

 ?>
