prepare( "INSERT INTO inquiries (name, company, email, phone, message, source_page) VALUES (?, ?, ?, ?, ?, ?)" ); $stmt->execute([$name, $company, $email, $phone, $message, $source_page]); // Send email notification $admin_email = getenv('MAIL_TO') ?: 'admin@example.com'; // Fallback $subject = "New Inquiry from " . htmlspecialchars($name); $body_html = "

New Inquiry

Name: " . htmlspecialchars($name) . "

Company: " . htmlspecialchars($company) . "

Email: " . htmlspecialchars($email) . "

Phone: " . htmlspecialchars($phone) . "

Message:

" . nl2br(htmlspecialchars($message)) . "

Source: " . htmlspecialchars($source_page) . "

"; $body_text = "New Inquiry\n\nName: " . $name . "\nCompany: " . $company . "\nEmail: " . $email . "\nPhone: " . $phone . "\nMessage: " . $message . "\nSource: " . $source_page; // Using MailService MailService::sendMail($admin_email, $subject, $body_html, $body_text, ['reply_to' => $email]); $success = true; } catch (PDOException $e) { $errors['db'] = 'There was a problem saving your inquiry. Please try again later.'; error_log('Inquiry Error: ' . $e->getMessage()); } catch (Exception $e) { $errors['mail'] = 'There was a problem sending the notification. Your inquiry was saved.'; error_log('Mail Error: ' . $e->getMessage()); } } } include __DIR__ . '/includes/header.php'; ?>

Contact Us

We would love to hear from you. Please fill out this form and we will get in touch with you shortly.