prepare( 'INSERT INTO service_requests (name, email, message) VALUES (?, ?, ?)' ); $stmt->execute([$name, $email, $service_message]); // Notify Admin $admin_email = getenv('MAIL_TO') ?: 'admin@example.com'; $subject = 'New Service Request from ' . $name; $html_content = "
Name: {$name}
Email: {$email}
Message:
{$service_message}
This request is now pending approval in the admin dashboard.
"; $text_content = strip_tags($html_content); MailService::sendMail($admin_email, $subject, $html_content, $text_content); $message = 'Thank you! Your service request has been submitted successfully. An account manager will review it shortly.'; $message_type = 'green'; } catch (PDOException $e) { // In a real app, log this error. $message = 'Sorry, there was an error submitting your request. Please try again later.'; $message_type = 'red'; } catch (Exception $e) { $message = 'Sorry, there was an error sending the notification. Please try again later.'; $message_type = 'red'; } } } require_once __DIR__ . '/header.php'; ?>