\r\n"; $headers .= "Reply-To: $email\r\n"; $headers .= "Content-Type: text/plain; charset=UTF-8\r\n"; // Send email if (mail($to, $subject, $body, $headers)) { echo json_encode(['status' => 'success', 'message' => 'Email sent successfully!', 'subject' => $subject]); } else { echo json_encode(['status' => 'error', 'message' => 'Failed to send the email.']); } } ?>