J
J
Julia G2020-07-05 08:17:29
WordPress
Julia G, 2020-07-05 08:17:29

Why are emails not coming from WordPress?

Hello.
Tell me, please, where to look and what to look for?
I know that many people ask questions about this topic. I read a lot of things, but I did not find the answer to my question.
The site is powered by WordPress - https://potolki-plafond.ru/
Previously, letters to the mail came without problems. A few days ago, letters stopped coming, although the site says that YOUR LETTER IS SENT.
I use the email-send.php file to send emails.
Here is the code from this file

<?php
    if ($_POST){

        function mime_header_encode($str, $data_charset, $send_charset) { 
            if($data_charset != $send_charset)
            $str=iconv($data_charset,$send_charset.'//IGNORE',$str);
            return ('=?'.$send_charset.'?B?'.base64_encode($str).'?=');
        }

        class TEmail {
            public $from_email;
            public $from_name;
            public $to_email;
            public $to_name;
            public $subject;
            public $data_charset='UTF-8';
            public $send_charset='windows-1251';
            public $body='';
            public $type='text/plain';
            function send(){
                $dc=$this->data_charset;
                $sc=$this->send_charset;
                $enc_to=mime_header_encode($this->to_name,$dc,$sc).' <'.$this->to_email.'>';
                $enc_subject=mime_header_encode($this->subject,$dc,$sc);
                $enc_from=mime_header_encode($this->from_name,$dc,$sc).' <'.$this->from_email.'>';
                $enc_body=$dc==$sc?$this->body:iconv($dc,$sc.'//IGNORE',$this->body);
                $headers='';
                $headers.="Mime-Version: 1.0\r\n";
                $headers.="Content-type: ".$this->type."; charset=".$sc."\r\n";
                $headers.="From: ".$enc_from."\r\n";
                return mail($enc_to,$enc_subject,$enc_body,$headers);
            }
        }



        $name = $_POST['name'];
        $date = $_POST['date'];
        $time = $_POST['time'];
        $phone = $_POST['phone'];
        $email = $_POST['email'];
        $url = $_POST['url'];
        $address = $_POST['address'];
        $tovar = $_POST['tovar'];



        $name_company = $_POST['name_company'];
        $name_training = $_POST['name_training'];
        $quantity = $_POST['quantity'];

        $demands = $_POST['demands'];


        if ($name) {
          $message .= "Имя - ".$name;
        }
        if ($phone) {
          $message .= "\nТелефон - ".$phone;
        }

        if ($email) {
          $message .= "\nemail - ".$email;
        }
        if ($date) {
          $message .= "\nДата - ".$date;
        }
        if ($time) {
          $message .= "\nВремя - ".$time;
        }
         if ($address) {
          $message .= "\nАдрес - ".$address;
        }
         if ($tovar) {
          $message .= "\nТовар - ".$tovar;
        }

        if ($name_company) {
          $message .= "\nНазвание компании - ".$name_company;
        }

        if ($name_training) {
          $message .= "\nНазвание треннинга - ".$name_training;
        }

        if ($quantity) {
          $message .= "\nКол-во человек - ".$quantity;
        }

        if ($demands) {
          $message .= "\nСообщение - ".$demands;
        }
      

  
      $emailgo= new TEmail; 
        $emailgo->from_email= 'SIP'; 
        $emailgo->from_name= 'SIP';
        $emailgo->to_email= '[email protected]';
        $emailgo->to_name= 'SIP';
        $emailgo->subject= 'Заявка с сайта Potolki-Plafond:';
        $emailgo->body= $message; 
        $emailgo->send(); 
        echo $messsage; //для debug
    } 

    else{
        echo 'access denial';
    }
?>


Previously, there was a message in the admin panel that you need to UPDATE PHP to a more recent version. This message is currently missing. Could it be related to each other?

Thank you all in advance!!!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2020-07-05
@Kozack

  1. Do not use the PHP mail() function when working with WordPress. To do this, he has - wp_mail() . I advise you to use it, as it will allow third-party plugins to work.
  2. The problem may be in the internal filter of the mail client. Such letters do not end up in spam or anywhere else. They just don't show up anywhere. Try sending an email to some random email, for example from @fakemailbot bot . There are no filters.
    1. If letters arrive there, then your server sends them, but the mail service is blocking. In this case, I advise you to try to send not from your server, but use third-party services, such as Gmail, Yandex. One way to implement it is through the WP Mail SMTP plugin from WPForms
    2. If letters do not come to such mail, then most likely your server does not send them. In this case, check what wp_mail() returns. Study server logs.

J
Julia G, 2020-07-07
@YuliyaG1

So far, unfortunately, the problem has not been solved.
The programmers at the hosting said that you need to look at the server logs.
I looked at the logs - when sending an application from the forms, it gives an error.

[Tue Jul 07 18:58:52.537406 2020] [fcgid:warn] [pid 29253] [client 176.59.48.142:40208] mod_fcgid: stderr: PHP Notice:  Undefined variable: messsage in /home/admin/web/potolki-plafond.ru/public_html/wp-content/themes/potolki-plafond/email-send.php on line 103, referer: https://potolki-plafond.ru/

And such error on each field from the form.
[Tue Jul 07 18:58:35.018688 2020] [fcgid:warn] [pid 28915] [client 176.59.48.142:40204] mod_fcgid: stderr: PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'create_my_post_types' not found or invalid function name in /home/admin/web/potolki-plafond.ru/public_html/wp-includes/class-wp-hook.php on line 287, referer: https://potolki-plafond.ru/pongs/

[Tue Jul 07 18:58:52.537375 2020] [fcgid:warn] [pid 29253] [client 176.59.48.142:40208] mod_fcgid: stderr: PHP Notice:  Undefined variable: message in /home/admin/web/potolki-plafond.ru/public_html/wp-content/themes/potolki-plafond/email-send.php on line 62, referer: https://potolki-plafond.ru/

Please tell me how to fix the error.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question