query("SELECT anfragebestaetigung FROM config LIMIT 1"); $anfragebestaetigung = (string)$stmt->fetchColumn(); if ($anfragebestaetigung === '') { throw new RuntimeException('Config anfragebestaetigung ist leer'); } $result = renderTemplateForAnfrage( $pdo, $anfrageid, $templetid, $anfragebestaetigung, // aus config [ // optional: // '%TERMINZEITVORGABE%' => $Zeitanzeige, ], false // CP1252 nur wenn nötig ); echo json_encode([ 'betreff' => $result['betreff'], 'body' => $result['body'] ]); } catch (Throwable $e) { http_response_code(500); echo json_encode([ 'error' => $e->getMessage() ]); }