Startseite: Anfrageformular sendet serverseitig, Landingpage und netcup-Ziel
- Neues oeffentliches Formular-Endpoint POST /anfrage (app/inquiry.php): Pflichtfelder ausser Nachricht, Validierung, Honeypot, IP-Limit 5/Stunde, Versand per mail_send() mit Reply-To des Kunden - kein mailto mehr - mail_send() akzeptiert zusaetzliche Kopfzeilen (CRLF bereinigt) - app.inquiry_email in Konfiguration und Deploy-Template (DIC_INQUIRY_EMAIL) - Statische Landingpage web/index.html mit Assets, Service-Worker-Cache dic-v18 - App-Routen auf /dashboard, netcup-Deploy-Doku und Fundstellen aktualisiert
This commit is contained in:
parent
273eabfdb7
commit
fe388838db
27 changed files with 2598 additions and 57 deletions
14
app/mail.php
14
app/mail.php
|
|
@ -22,8 +22,14 @@ function mail_is_enabled(): bool
|
|||
/**
|
||||
* Verschickt eine reine Textnachricht. Absender kommt aus app.mail_from.
|
||||
* Der Aufrufer prüft mail_is_enabled() und die Empfängeradresse.
|
||||
*
|
||||
* $extraHeaders erlaubt zusätzliche Kopfzeilen (z. B. Reply-To für das
|
||||
* Anfrageformular); Zeilenumbrüche werden entfernt, damit niemand weitere
|
||||
* Header einschleusen kann.
|
||||
*
|
||||
* @param list<string> $extraHeaders
|
||||
*/
|
||||
function mail_send(string $to, string $subject, string $body): bool
|
||||
function mail_send(string $to, string $subject, string $body, array $extraHeaders = []): bool
|
||||
{
|
||||
if (!filter_var($to, FILTER_VALIDATE_EMAIL)) {
|
||||
return false;
|
||||
|
|
@ -34,6 +40,12 @@ function mail_send(string $to, string $subject, string $body): bool
|
|||
'Content-Type: text/plain; charset=UTF-8',
|
||||
'Content-Transfer-Encoding: 8bit',
|
||||
];
|
||||
foreach ($extraHeaders as $header) {
|
||||
$clean = trim(preg_replace('/[\r\n]+/', ' ', $header) ?? '');
|
||||
if ($clean !== '') {
|
||||
$headers[] = $clean;
|
||||
}
|
||||
}
|
||||
return @mail(
|
||||
$to,
|
||||
mb_encode_mimeheader($subject, 'UTF-8', 'B'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue