0

I have tested this script and ajax is sending data so this variables are good. I have echo every one of them, they are working fine... When I send email I get success so its working? But im not getting anything on my mail?

<?php

    // save input values
    $title = $_POST['var1'];
    $email = $_POST['var2'];
    $msg = $_POST['var3'];

    // setup email info
    $to      = "wersastudio@gmail.com";
    $subject = $title;
    $txt     = $msg;
    $headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    // send email
    $send = mail($to,$subject,$txt,$headers);

    // check if email is send or not
    if ( $send ) {
        echo 'success';
    }else {
        echo 'error';
    }
?>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Edy Mrkos
  • 43
  • 1
  • 4
  • Sorry for this dont know why the webpage didnt show my php so I have send it in comment above. – Edy Mrkos Sep 18 '16 at 21:04
  • You don't need `Reply-to` if it's the same as `From`. – Barmar Sep 18 '16 at 21:08
  • 1
    Check your server's mail log to see if the mail was sent. It could also be getting filtered as spam. – Barmar Sep 18 '16 at 21:09
  • Is this running on a local server such as XAMPP, or a cloud based server? If you're not on a local environment, you'll need to set the reply to, and from email addresses to something at your own domain (e.g. noreply@mydomain.com). If it is a local server, you probably need to setup an email server such as sendmail. XAMPP and WAMP do not do this by default. – Brian Schroeter Sep 18 '16 at 22:43

0 Answers0