How can PHP be used to handle and display form data in a more visually appealing manner, such as adding color or styling to the email content?

To handle and display form data in a more visually appealing manner using PHP, you can use HTML and CSS to style the content. This can include adding colors, fonts, borders, and other styling elements to make the email content more visually appealing.

<?php
$email = $_POST['email']; // Assuming 'email' is the name attribute of the form input field

// HTML email content with styling
$message = "
<html>
<head>
<style>
  body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    padding: 20px;
  }
  .email-content {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 20px;
  }
</style>
</head>
<body>
<div class='email-content'>
<h2>Your Email Content:</h2>
<p>$email</p>
</div>
</body>
</html>
";

// Additional headers
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// Send email
mail('recipient@example.com', 'Subject', $message, $headers);
?>