'error', 'message' => 'Please fill in all required fields.' ]); exit; } // Email configuration - CHANGE THIS TO YOUR EMAIL $to = "info@multi-flows.com"; // Replace with your actual email $subject = "New Contact Form Submission - Multi-Flows.com"; // Email content $email_body = "New contact form submission from Multi-Flows.com website:\n\n"; $email_body .= "Name: $name\n"; $email_body .= "Email: $email\n"; $email_body .= "Company: $company\n"; $email_body .= "Industry: $industry\n\n"; $email_body .= "Message:\n$message\n\n"; $email_body .= "---\n"; $email_body .= "Submitted on: " . date('Y-m-d H:i:s') . "\n"; $email_body .= "IP Address: " . $_SERVER['REMOTE_ADDR'] . "\n"; // Email headers $headers = "From: noreply@" . $_SERVER['HTTP_HOST'] . "\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "Content-Type: text/plain; charset=UTF-8\r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); // Try to send email if (mail($to, $subject, $email_body, $headers)) { // Log the submission (optional) $log_entry = date('Y-m-d H:i:s') . " | $name | $email | $company | $industry\n"; @file_put_contents('contact_log.txt', $log_entry, FILE_APPEND | LOCK_EX); echo json_encode([ 'status' => 'success', 'message' => 'Thank you! Your message has been sent successfully. We will get back to you soon.' ]); } else { echo json_encode([ 'status' => 'error', 'message' => 'Sorry, there was an error sending your message. Please try again or contact us directly at info@multi-flows.com' ]); } } else { echo json_encode([ 'status' => 'error', 'message' => 'Invalid request method.' ]); } ?>