I'm working on one small "demo request" form. That form should be send request for demo on my email address. Process: 1) User want demo, just need to fill this form and press Submit. 2) I'll get email with details and after I can be in touch with client using details from email (username, email)
I'm using PHP mail() function for that but doesn't want to send me message on email. I tried from my localhost and also from mail hosting server. Doesn't work in both case.
HTML FORM:
<form id="RD-form" method="post" action="php/request-demo.php">
<input name="name" type="text" required placeholder="Your name"><br><br>
<input name="email" type="email" required placeholder="Your email address"><br><br>
<input type="submit" value="Submit">
</form>
PHP CODE:
$sendto = "test@gmail.com";
$username = $_POST["name"];
$email = $_POST["email"];
echo "Hello , my name is ".$username.". I want to try demo version. Please contact me on ".$email."";
$message = "Hello!\n My name is ".$username.". I want to try demo version. \nPlease contact me on ".$email."";
mail($sendto, $username, $message);
As you can see, echo function works good, just mail() makes a problem.