I am learning about using php to send emails. I managed to get brackets working with XAMPP on macOS Mojave and I'm running the following script
<?php
    $emailTo = "me@mydomain.com"; 
    $subject = "I hope this works!";
    $body = "test simple email";
    $headers = "From: me@mydomain.com";
    if(mail($emailTo, $subject, $body, $headers)){
        echo "Your message was sent, we\'ll get back to you ASAP!";
    } else {
        echo "Your message was not sent successfully.";
    }
?>
leads to the following result:
Your message was not sent successfully.
I am a beginner in doing this and I thought I may ask for some feedback.
 
    