Good evening. Something does not work function mail (), although the hosting has the ability to send mail (test more primitive).

The form:

<form class="mg-t-sm" role="form" method="post" action="php/rsvp.php" id="rsvpForm"> <div class="form-group"> <label class="sr-only" for="yourName">Ваше полное имя</label> <input class="form-control" name="yourName" type="text" id="yourName" placeholder="Ваше полное имя" required> </div> <div class="form-group"> <label class="sr-only" for="yourEmail">Ваш email адрес</label> <input class="form-control" name="yourMail" type="email" id="yourEmail" placeholder="Ваш email адрес" required> </div> <div class="form-group"> <label class="sr-only" for="yourGuests">Количество гостей</label> <input class="form-control" name="yourGuests" type="text" id="yourGuests" placeholder="Количество гостей" required> </div> <div class="form-group"> <label class="sr-only" for="yourMessage">Ваши пожелания молодоженам</label> <input class="form-control" name="yourReal" type="hidden" id="yourReal"> </div> <div class="form-group"> <textarea class="form-control" name="yourMessage" id="yourMessage" placeholder="Ваши пожелания молодоженам" rows="6"></textarea> </div> <div class="submit-wrap"> <button class="btn btn-primary btn-lg" type="submit">Отправить</button> </div> <div id="successMsg" class="hidden"> <br> <div class="alert alert-success"> <p>Thanks, your message has been sent!</p> </div> </div> </form> 

PHP code:

 <?php $to = "adobe-master@ukr.net"; // add your email address $subject = "RSVP form submission"; // the subject of emails /* ------------------------------------------------------------------ */ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $name = check_input($_POST['name']); $email = check_input($_POST['email']); $guests = check_input($_POST['guests']); $message = check_input($_POST['message']); $human = check_input($_POST['human']); if (empty($human)) { $headers = "From: " . $to . "\r\n"; $headers .= "Reply-To: ". $email . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=UTF-8\r\n"; $body = "<html><body>"; $body .= "<h1>" . $subject . "</h1>"; $body .= "<p><strong>Name: </strong>" . $name . "</p>"; $body .= "<p><strong>E-mail: </strong>" . $email . "</p>"; $body .= "<p><strong>Guests: </strong>" . $guests . "</p>"; $body .= "<p>" . strip_tags($message) . "</p>"; $body .= "</body></html>"; if (!empty($to) && !empty($subject) && !empty($name) && !empty($email) && !empty($guests) && filter_var($email, FILTER_VALIDATE_EMAIL) && !empty($message)) { mail($to, $subject, $body, $headers); echo("success"); } } else { echo("success"); } } function check_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = strip_tags($data); return $data; } ?> 

I would be grateful for the help!

  • Spam folders checked? Does the wrapped letter arrive? - Naumov
  • one
    Use PHPMailer or email gateways, such as Mailgun. - neluzhin

0