<?php

if ("" == $ntk['Email'])
{
	echo "<h1>Dem Empfänger ist keine Email-Adresse zugeordnet</h1>\n";
}
else
{
	$text = $var;
	$var = $_SESSION['Firma']['Gruss'];
	include __DIR__ . "/../pdf/replace_gruss.php";
	$text .= $var;
	$text .= "\n" . $_SESSION['Firma']['Email_Signatur'];
	echo "<form action=\"index.php?section=mail\" method=\"post\">\n";
	echo "	<fieldset>\n";
	echo "		<legend>" . $Typ . " per Email versenden</legend>\n";
	if (!$ntk['DSchutz'])
	{
		echo "		<h2>Achtung: Es liegt keine Datenschutzerklärung vor!</h2>\n";
	}
	echo "		<h2>" . $Typ . " - Nr. " . $nt['Jahr'] . "_" . $nt['ID'] . " wird an folgenden Empfänger versendet:</h2>\n";
	echo "		<label>Firma</label><label class=\"data\">" . $ntk['Firma'] . "</label>\n";
	echo "		<br />\n";
	echo "		<label>Kunde</label><label class=\"data\">" . $ntk['Anrede'] . " " . $ntk['Vorname'] . " " . $ntk['Nachname'] . "</label>\n";
	echo "		<br />\n";
	echo "		<label>Email-Adresse:</label><label class=\"data\"><a href=\"mailto:" . $ntk['Email'] . "\">" . $ntk['Email'] . "</a></label>\n";
	echo "		<br />\n";
	echo "		<label>Betreff</label><label class=\"data\">" . $nttext['Betreff'] . "</label>\n";
	echo "		<br />\n";
	echo "		<label>Anhang</label><label class=\"data\"><a href=\"" . $file . "\" target=\"_blank\">" . $Typ . ": " . $nt['Jahr'] . "_" . $nt['ID'] . "</a></label>\n";
	echo "		<br />&nbsp;<br />\n";
	echo "		<fieldset>\n";
	echo "			<legend class=\"sub\">Email-Text:</legend>\n";
	echo "			<p>";
	echo nl2br($text);
	echo "</p>\n";
	echo "		</fieldset>\n";
	echo "	</fieldset>\n";
	echo "	<fieldset>\n";
	echo "		<legend>" . $Typ . " - Versand bestätigen</legend>\n";
	echo "		<input type=\"hidden\" name=\"ID\" value=\"" . $Typ . "_" . $_POST['ID'] . ".pdf\" />\n";
	echo "		<input type=\"hidden\" name=\"Email_to\" value=\"" . $ntk['Email'] . "\" />\n";
	echo "		<input type=\"hidden\" name=\"Email_from\" value=\"" . $nta['EMail'] . "\" />\n";
	echo "		<input type=\"hidden\" name=\"Name_from\" value=\"" . $nta['Vorname'] . " " . $nta['Nachname'] . "\" />\n";
	echo "		<input type=\"hidden\" name=\"Subject\" value=\"" . $nttext['Betreff'] . "\" />\n";
	echo "		<input type=\"hidden\" name=\"Attached\" value=\"" . $file . "\" />\n";
	echo "		<input type=\"hidden\" name=\"Text\" value=\"" . $text . "\" />\n";
	echo "		<input type=\"submit\" class=\"button_email\" name=\"formaction\" value=\"mail\" title=\"" . $Typ . " per Email versenden\" />\n";
	echo "	</fieldset>\n";
	echo "</form>\n";
}