116 lines
4.0 KiB
PHP
116 lines
4.0 KiB
PHP
<?php include "html-head.php"; ?>
|
|
|
|
<style>
|
|
|
|
body {
|
|
margin: 0;
|
|
font-size: 18px;
|
|
font-weight: 400;
|
|
line-height: 1.5;
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
|
}
|
|
|
|
#container {
|
|
padding: 25px;
|
|
}
|
|
|
|
.spacer-10 {
|
|
height: 10px;
|
|
}
|
|
|
|
</style>
|
|
|
|
<title>PHP Mail GUI – Elias Fink</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php
|
|
|
|
if ( $_POST ) {
|
|
|
|
$from_name = filter_var ( $_POST['from_name'], FILTER_SANITIZE_STRING );
|
|
$from_email = filter_var ( $_POST['from_email'], FILTER_SANITIZE_STRING );
|
|
|
|
$to = filter_var ( $_POST['to'], FILTER_SANITIZE_STRING );
|
|
|
|
$subject = filter_var ( $_POST['subject'], FILTER_SANITIZE_STRING );
|
|
|
|
$message = '<div>' . nl2br ( htmlspecialchars ( $_POST['message'] ) ) . '</div>';
|
|
|
|
$cc = filter_var ( $_POST['cc'], FILTER_SANITIZE_STRING );
|
|
$bcc = filter_var ( $_POST['bcc'], FILTER_SANITIZE_STRING );
|
|
$reply_to = filter_var ( $_POST['reply_to'], FILTER_SANITIZE_STRING );
|
|
|
|
$headers = 'MIME-Version: 1.0' . "\r\n"
|
|
.'Content-type: text/html; charset=utf-8' . "\r\n"
|
|
.'From: ' . $from_name . ' <' . $from_email . '>' . "\r\n"
|
|
.'Cc: ' . $cc . "\r\n"
|
|
.'Bcc: ' . $bcc . "\r\n"
|
|
.'Reply-To: ' . $reply_to . "\r\n";
|
|
|
|
if ( mail ( $to, $subject, $message, $headers ) ) {
|
|
|
|
echo '<h1 style="color:#0c0;">Nachricht erfolgreich gesendet</h1>';
|
|
echo '<p><b>Von:</b> ' . $from_name . ' <' . $from_email . '></p>';
|
|
echo '<p><b>An:</b> ' . $to . '</p>';
|
|
echo '<p><b>Betreff:</b> ' . $subject . '</p>';
|
|
echo '<p><b>Nachricht:</b></p>' . $message;
|
|
echo '<p><b>Cc:</b> ' . $cc . '</p>';
|
|
echo '<p><b>Bcc:</b> ' . $bcc . '</p>';
|
|
echo '<p><b>Antwort an:</b> ' . $reply_to . '</p>';
|
|
|
|
} else {
|
|
|
|
echo '<h1 style="color:red;">Senden der Nachricht fehlgeschlagen</h1>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div id="container">
|
|
|
|
<form action="mail.php" method="post">
|
|
|
|
<div id="form-left">
|
|
|
|
<label for="from_name">Von:</label>
|
|
<input type="text" id="from_name" name="from_name" placeholder="Name" required>
|
|
<input type="text" id="from_email" name="from_email" placeholder="E-Mail" required>
|
|
<div class="spacer-10"></div>
|
|
<label for="to">An:</label>
|
|
<input type="text" id="to" name="to" required>
|
|
<div class="spacer-10"></div>
|
|
<label for="subject">Betreff:</label><div class="spacer-10"></div>
|
|
<input type="text" id="subject" name="subject" required>
|
|
<div class="spacer-10"></div>
|
|
<label for="message">Nachricht:</label><div class="spacer-10"></div>
|
|
<textarea id="message" name="message" required></textarea>
|
|
|
|
</div>
|
|
|
|
<div id="form-right">
|
|
|
|
<label for="cc">Cc:</label>
|
|
<input type="text" id="cc" name="cc">
|
|
<div class="spacer-10"></div>
|
|
<label for="bcc">Bcc:</label>
|
|
<input type="text" id="bcc" name="bcc">
|
|
<div class="spacer-10"></div>
|
|
<label for="reply_to">Antwort an:</label>
|
|
<input type="text" id="reply_to" name="reply_to">
|
|
|
|
</div>
|
|
|
|
<input type="submit" value="E-Mail senden">
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|