How to teach feedback form to accommodate the different domains e-mail?

Stopped working feedback form. More precisely, when the domain after @ of the 3 letters texts. But if 2 letters, the message is not sent. So if you specify email sender for example test@mail.ru - messages are not sent, and if you specify test@mail.com messages arrive as expected.
Here is the handler code, help edit that worked regardless of the number of letters in the domain.

file handler:
<?php

class Mail
{
 const MAIL_HEADER_SEPARATOR = "\r\n"; // "\r\n" complies with RFC 2822 but might cause problems in some cases (see http://php.net/manual/en/function.mail.php)
 const MAIL_HEADER_TRANSFER_ENCODING = 'B'; // 'B' for Base64, or 'Q' for Quoted-Printable
 private $charset = 'utf-8';

 public function __construct()
{
mb_internal_encoding($this--->charset);
}

 public function set_charset($charset)
{
 $this->charset = $charset;
mb_internal_encoding($this->charset);
}

 public function is_valid_email($email)
{
 if(preg_match("/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/", $email))
{
 return true;
}
 return false;
}

 public function escape_display_name($display_name)
{
 $display_name = str_replace('"', '\\"', $display_name);
 if(preg_match("/(\.|\;|\")/", $display_name))
{
 return '"'.mb_encode_mimeheader($display_name, $this->charset, self::MAIL_HEADER_TRANSFER_ENCODING, self::MAIL_HEADER_SEPARATOR).'"';
}
else
{
 return mb_encode_mimeheader($display_name, $this->charset, self::MAIL_HEADER_TRANSFER_ENCODING, self::MAIL_HEADER_SEPARATOR);
}
}

 public function make_address($display_name, $email)
{
 return $this->escape_display_name($display_name).' <'.$email.'>';
}

 private function mail_header_filter($string)
{
 #return preg_replace("/(\015\012|\015|\012|content-transfer-encoding:|mime-version:|content-type:|subject:|to:|cc:|bcc:|from:|reply-to:)/ims", ", $string);
 #return preg_replace("/(\015\012|\015|\012|to:|cc:|bcc:|from:|reply-to:)/ims", ", $string);
 return preg_replace("/(\015\012|\015|\012)/", ", $string);
}

 private function my_quoted_printable_encode($input, $line_max=76, $space_conv = false )
{
 $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
 $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
 $eol = "\n";
 $escape = '=';
 $output = ";
 while(list(, $line) = each($lines))
{
 $linlen = strlen($line);
 $newline = ";
 for($i = 0; $i < $linlen; $i++)
{
 $c = substr($line, $i, 1);
 $dec = ord( $c );
 if(($i == 0) && ($dec == 46)) // convert first point in the line into =2E
 { 
 $c = '=2E';
}
 if($dec == 32)
{
 if($i==($linlen-1)) // convert space at eol only
{
 $c = '=20';
}
elseif($space_conv)
{
 $c = '=20';
}
}
 elseif(($dec == 61) || ($dec < 32) || ($dec > 126)) // always encode "\t", which is *not* required
 { 
 $h2 = floor($dec/16);
 $h1 = floor($dec%16);
 $c = $escape.$hex[$h2].$hex[$h1];
}
 if((strlen($newline) + strlen($c)) >= $line_max) // CRLF is not counted
 { 
 $output .= $newline.$escape.$eol; // soft line break; "=\r\n" is okay
 $newline = ";
 if($dec == 46) // check if newline first character will be point or not
{
 $c = '=2E';
}
}
 $newline .= $c;
 } // end of for
 $output .= $newline.$eol;
 } // end of while
 return $output;
}

 public function send($to, $from, $subject, $message, $additional_parameters=")
{
 $to = $this->mail_header_filter($to);
 $subject = mb_encode_mimeheader($this->mail_header_filter($subject), $this->charset, self::MAIL_HEADER_TRANSFER_ENCODING, self::MAIL_HEADER_SEPARATOR);
 $message = $this->my_quoted_printable_encode($message);

 $headers = "From:" . $this->mail_header_filter($from) . self::MAIL_HEADER_SEPARATOR;
 $headers .= "MIME-Version: 1.0" . self::MAIL_HEADER_SEPARATOR;
 $headers .= "X-Sender-IP: ".$_SERVER["REMOTE_ADDR"] . self::MAIL_HEADER_SEPARATOR;
 #$headers .= "X-Mailer:" . BASE_URL . self::MAIL_HEADER_SEPARATOR;
 $headers .= "Content-Type: text/plain; charset=" . $this->charset . self::MAIL_HEADER_SEPARATOR;
 $headers .= "Content-Transfer-Encoding: quoted-printable";

if($additional_parameters)
{
 if(@mail($to, $subject, $message, $headers, $additional_parameters))
{
 return true;
}
else
{
 return false;
}
}
else
{
 if(@mail($to, $subject, $message, $headers))
{
 return true;
}
else
{
 return false;
}
}
}
}
?>
July 9th 19 at 10:28
4 answers
July 9th 19 at 10:30
Mail ceased to walk, because for a domain mail.ru enabled DMARC, protecting the letters from the fakes:
https://habrahabr.ru/company/mailru/blog/282602/
July 9th 19 at 10:32
Maybe not "stop go" and "no longer walk"?
In the "spam" you were looking for?
Post the logs looked?
In the spam folder comes. In General, the letter does not come, if you specify test@mail.ru but with test@mail.run no problem sent. - chadrick.Hagenes62 commented on July 9th 19 at 10:35
The mail logs to see if hosting is not virtual.
Can messages are filtered due to modern methods of fighting spam - DKIM signature or something like that. - Daphne_Roob commented on July 9th 19 at 10:38
: Hosting virtual alas.
Strange filtered some emails with the specified soap come others are not. - chadrick.Hagenes62 commented on July 9th 19 at 10:41
July 9th 19 at 10:34
Line:
if(preg_match("/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/", $email))

Replace:
if(preg_match("/[0-9a-zA-Z\.\-_]{1,}@[0-9a-zA-Z\-_]{1,}\.[0-9a-zA-Z\-_]{1,}[\.0-9a-zA-Z]{0,}/", $email))
Dmitry thank you that responded, but still not working. I can not understand why not send. And it is fine on one hosting on multiple such troubles.
with test@mail.com there is a letter 2-letter (.EN) in any. It transportere was busy all the same on the spot easy. - chadrick.Hagenes62 commented on July 9th 19 at 10:37
July 9th 19 at 10:36
It seems the problem is on your side mail.ru looks like something they set up so that the mail stopped coming. Write in the mail a ticket in support waiting for an answer.

Find more questions by tags E-mailPHP