There is a simple form with the requirement of email. It is necessary that this data be sent from it to my email. How to implement it? I am sure it is not difficult, just need to know how. Thank!
<div class="w-form"> <form action="send.php" class="email-address w-clearfix" data-name="Email Form" id="mc_embed_signup" method="post" name="email-form"><input class="email-address w-input" data-name="Email" id="Email-Address" maxlength="256" name="email" placeholder="Enter your email address" required="required" type="email"><input class="button w-button" data-wait="Please wait..." type="submit" onclick="ga('send', 'event', 'Верхняяформа', 'submit')" value="Start playing today"></form> <div class="success-message-2 w-form-done"> <div>Thank you! Please check your email now.</div> </div> <div class="w-form-fail"> <div>Oops! Something went wrong while submitting the form</div> </div> </div> </div> UP
Created send.php, but does not work. A page opens with characters and everything on it. What's wrong?
<?php if($_POST) { $to = "pianoforall.lessons@gmail.com"; //куда отправлять письмо $subject = "Новый"; //тема $message = 'Имейл: '.$_POST['email'].';'; $headers = "Content-type: text/html; charset=UTF-8 \r\n"; $headers .= "From: <news@new-pianoforall.com>\r\n"; $result = mail($to, $subject, $message, $headers); if ($result){ echo "Cообщение успешно отправленно. Пожалуйста, оставайтесь на связи"; } } ?>
mail(....- php.net/manual/ru/function.mail.php - Alexey Shimansky