diff options
| author | Jonas Kohl | 2024-09-06 12:01:12 +0200 | 
|---|---|---|
| committer | Jonas Kohl | 2024-09-06 12:01:12 +0200 | 
| commit | 4da448fe73005e3f3a57671575f99555793adb06 (patch) | |
| tree | 98b5684f9c873ac4d69c97ce5671f4f67d34b6d4 /cgi/contact.php | |
| parent | e397ef954d7b3d07c7cb39aae910b3dbb8e27fc5 (diff) | |
Update contact form stuff
Diffstat (limited to 'cgi/contact.php')
| -rwxr-xr-x | cgi/contact.php | 9 | 
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")  |