summaryrefslogtreecommitdiff
path: root/cgi/contact.php
diff options
context:
space:
mode:
Diffstat (limited to 'cgi/contact.php')
-rwxr-xr-xcgi/contact.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/cgi/contact.php b/cgi/contact.php
index c6d18d9..3aceaac 100755
--- a/cgi/contact.php
+++ b/cgi/contact.php
@@ -8,7 +8,7 @@ session_start();
function missing_field(string $name): never {
http_response_code(400);
- echo "Missing or malformed field $name\n";
+ echo "Missing or malformed field '$name'\n";
exit;
}
@@ -17,7 +17,7 @@ function getenv_or_fail(string $key): ?string {
if ($value !== false)
return $value;
http_response_code(500);
- echo "Missing environment variable $key\n";
+ echo "Missing environment variable '$key'\n";
exit;
}
@@ -61,6 +61,11 @@ $mailer_dsn = getenv_or_fail("MAILER_DSN");
$transport = Transport::fromDsn($mailer_dsn);
+$time = (new DateTimeImmutable("now", new DateTimeZone("Europe/Berlin")))->format("d.m.y \\u\\m H:i");
+
+$message = implode("\n", array_map(fn($ln) => "> $ln", preg_split('~(*BSR_ANYCRLF)\R~', trim($message))));
+$message = "Am $time schrieb $name via Kontaktformular:\n$message\n";
+
$transport->send((new Email())
->from(new Address("mystic-contactform+no-reply@jonaskohl.de", $name))
->to("mystic@jonaskohl.de")