0

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.

Stefan Becker
  • 5,695
  • 9
  • 20
  • 30
mansanto
  • 360
  • 4
  • 16
  • Look for mail [headers](https://stackoverflow.com/questions/566182/complete-mail-header) – TarangP Feb 13 '19 at 07:16
  • The first thing I would do would be to look at the exact error message, see [How can I get the error message for the mail() function?](https://stackoverflow.com/q/3186725) – Stefan Becker Feb 13 '19 at 07:19

0 Answers0