forked from amah/kummerkasten-php
mail_fixes #1
1 changed files with 18 additions and 6 deletions
Fixed E-Mail encoding issues (probably)
commit
ba164b4f67
24
index.php
24
index.php
|
|
@ -1,5 +1,4 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<?php
|
||||
$lang = $_GET['lang'] ?? $lang = "de";
|
||||
|
|
@ -14,9 +13,19 @@ $go_back = $text["go_back"];
|
|||
$recipient = $text["recipient"];
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
$subject = "[Kummerkasten] " . $_POST["subject"];
|
||||
$message = $_POST["message"];
|
||||
if (mail($recipient, $subject, $message)) {
|
||||
$subject = mb_encode_mimeheader(
|
||||
"[Kummerkasten] " . $_POST["subject"],
|
||||
"UTF-8",
|
||||
"Q"
|
||||
);
|
||||
$message = wordwrap($_POST["message"], 77, " \r\n"); // see rfc5322 section-2.1.1
|
||||
|
||||
$headers = [
|
||||
"Content-Transfer-Encoding" => "binary",
|
||||
"Content-Type" => 'text/plain; charset="UTF-8"; format="flowed"',
|
||||
];
|
||||
|
||||
if (mail($recipient, $subject, $message, $headers)) {
|
||||
header("Location: success.php?lang=$lang");
|
||||
} else {
|
||||
header("Location: failed.php?lang=$lang");
|
||||
|
|
@ -24,6 +33,7 @@ if (isset($_POST["submit"])) {
|
|||
die();
|
||||
}
|
||||
?>
|
||||
<html lang="<?php echo $lang; ?>">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
|
@ -48,7 +58,9 @@ if (isset($_POST["submit"])) {
|
|||
</nav>
|
||||
</header>
|
||||
<p id="about" class="infobox"><?php echo $about; ?></p>
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"] . '?' . http_build_query($_GET); ?>" method="post">
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"] .
|
||||
"?" .
|
||||
http_build_query($_GET); ?>" method="post" accept-charset="UTF-8">
|
||||
<input type="text" id="subject" name="subject" placeholder="<?php echo $subject_placeholder; ?>"></input>
|
||||
<textarea id="message" name="message" placeholder="<?php echo $message_placeholder; ?>" rows="15"></textarea>
|
||||
<button class="btn btn-primary" type="submit" name="submit"><?php echo $send_button; ?></button>
|
||||
|
|
@ -59,4 +71,4 @@ if (isset($_POST["submit"])) {
|
|||
</p>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue