A
A
AlekseyAlo2019-01-21 11:58:30
Email
AlekseyAlo, 2019-01-21 11:58:30

Sending a message from the site, the letter does not come, what could be the problem?

Hello. The problem with the letters from the feedback on the site. Letters from the form on the site come from my computer on all browsers and from mobile devices, letters do not reach from other devices, regardless of the browser.
here is php

<?php
 
if(isset($_POST['email'])) {
 
     
    // EDIT THE 2 LINES BELOW AS REQUIRED
 
    $email_to = "[email protected]"; 
    $email_subject = "Важно! У ВАС НОВАЯ ЗАЯВКА!";
  
 
    function died($error) {
 
        // your error code can go here
 
        echo "Извините Ваша форма не была отправлена. "; 
        echo "Вы совершили ошибки в заполнении формы.<br /><br />"; 
        echo $error."<br /><br />"; 
        echo "Пожалуйста вернитесь назад и исправьте ошибки.<br /><br />"; 
        die();
 
    }
 
     
 
    // validation expected data exists
 
    if(!isset($_POST['first_name']) || 
        !isset($_POST['email']) || 
        !isset($_POST['telephone']))  
  { 
        died('Пожалуйста вернитесь назад и заполните все поля формы заявки.');        
    }
      
 
    $first_name = $_POST['first_name']; // required 
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required       
    $error_message = "";
 

    $email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; 
  if(!preg_match($email_exp,$email_from)) {
 
    $error_message .= 'Email адрес введен в неверном формате.<br />';
 
  }
 
  if(strlen($first_name) < 2) { 
    $error_message .= 'Вы не ввели Ваше имя.<br />';
 
  }

 
  if(strlen($error_message) > 0) {
 
    died($error_message);
 
  }
 
    $email_message = "Детали формы.\n\n";
 
     
 
    function clean_string($string) {
 
      $bad = array("content-type","bcc:","to:","cc:","href");
 
      return str_replace($bad,"",$string);
 
    }
 
     
 
    $email_message .= "Имя: ".clean_string($first_name)."\n"; 
    $email_message .= "Email: ".clean_string($email_from)."\n"; 
    $email_message .= "Телефон: ".clean_string($telephone)."\n";
 
     
 
     

  // $send = mail ($address,$sub,$mes,"Content-type:text/plain; charset = utf-8\r\nFrom:$email");
  //$headers .= "MIME-Version: 1.0"."\r\n" ."Content-type: text/plain; charset='utf-8'". "\r\n";
 
// create email headers
 
$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

    //новия код (new code)
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset='utf8'". "\r\n";

 
@mail($email_to, $email_subject, $email_message, $headers);  
 
?>
 
 
 
<!-- include your own success html here -->
 
 
 
Спасибо, что оставили заявку. Наш менеджер свяжется с Вами в ближайшее время.
 
 
 
<?php
 
}
 
?>

form on the site
<section id="contact">
      <div class="container">
        <div class="row">
          <div class="col-lg-12 col-md-12">
            <!-- START SUBSCRIBE HEADING -->
            <div class="heading">
            
            
            </div>
            <!-- BEGAIN SUBSCRIVE FORM -->
             <div class="contact_form">

                <!-- FOR CONTACT FORM MESSAGE -->
                <div id="form-messages" ></div>
                  <form id="contact" action="send_form_email.php" method="post">
                  <input class="form-control" type="text" name="first_name" placeholder="Ваше Имя">
                  <input class="form-control" type="email" name="email" placeholder="Ваша электронная почта">
                  <input class="form-control" type="text" name="telephone" placeholder="Сообщение">

                   <input class="submit_btn btn floating pulse btn-large  waves-effect green white-text darken-text-2"  type="submit" value="Отправить">  
                </form>
        
              </div>
          </div>
        </div>
      </div>
    </section>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2019-01-21
@feanor7

If I understand your host correctly, it sends messages to [email protected] from an address that does not belong to it. It's crazy that any anti-spam will cut down such letters.
and of course, you need to look at the settings of the MTA installed on the host, without it, no form will send anything anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question