Are there alternative methods to achieve the same functionality as an indirect mailto link in PHP?

When using an indirect mailto link in PHP, the email address is not directly visible in the HTML source code, which can help prevent email harvesting by spambots. An alternative method to achieve the same functionality is to use a server-side script to process the form submission and send the email without exposing the email address in the HTML.

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $to = "recipient@example.com";
    $subject = "Contact Form Submission";
    $message = $_POST["message"];
    $headers = "From: " . $_POST["email"];
    
    if (mail($to, $subject, $message, $headers)) {
        echo "Email sent successfully";
    } else {
        echo "Email sending failed";
    }
}
?>