The site on WordPress , hosting and domain of the site are on REG.RU , the domain is Cyrillic. Applications from the feedback form come, but for some reason they fall into the Spam folder.

Sending applications tried to do the mail Mail.ru and Google , in both cases, got into spam. PHP handler used its own, put it in the root of the WordPress installation, the code below provided. I also tried to send via Contact Form 7 plugin, there are also letters in spam.

I do not know what to do anymore, tell me, please, how can this problem be solved?

<?php header("Content-Type: text/html; charset=utf-8"); $name = htmlspecialchars($_POST["name"]); $tel = htmlspecialchars($_POST["phone"]); $email = htmlspecialchars($_POST["email"]); $refferer = getenv('HTTP_REFERER'); $date = date("dmy"); // число.месяц.год $time = date("H:i"); // часы:минуты:секунды $myemail = "sergey_5550199@mail.ru"; $tema = "Новый заказ"; $message_to_myemail = "Уважаемый администратор, Вам поступил новый заказ <br><br> Имя: $name<br> Телефон: $tel<br> Источник (ссылка): $refferer<br> "; mail( $myemail, $tema, $message_to_myemail, "Reply-To: Davydov-Event \r\n"."MIME-Version: 1.0\r\n"."Content-type: text/html; charset=utf-8\r\n" ); $tema = "Заказ принят"; $message_to_myemail = " Спасибо, Ваш заказ успешно принят "; $myemail = $email; mail($myemail, $tema, $message_to_myemail, "From: Davydov-Event \r\n Reply- To: Davydov-Event \r\n"."MIME-Version: 1.0\r\n"."Content-type: text/html; charset=utf-8\r\n" ); 
  • one
    And if you change the content type? - user33274
  • one
    @ MaksimLensky has nothing to do with spam - KAGG Design
  • one
    @KAGGDesign did not know ... but seemingly in the basics of php where it was this that changing the content-type affects ... or maybe I'm wrong - user33274
  • 1. Use plug-ins, rather than holey, self-written forms. 2. Configure SPF, DKIM, DMARC correctly. 3. If mail leaves this form - hosting is full of holes. Change nafik! And yes .. it's regr. Change, change urgently! - SeVlad

2 answers 2

There are several levels of problems.

Do not use the mail () function to be obsolete. WordPress has wp_mail () instead.

In order for wp_mail () to work in your handler, you need to initialize the kernel in it:

 require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' ); 

You can use the Contact Form 7 plugin, it works via wp_mail ().

But the main problem is that you should have SPF, DKIM, DMARC records in DNS. There are none - everything flies to spam.

In addition, it is better not to send from your server (IP may be in the black list of spammers), but using relay, from yandex or google SMTP servers.

This will help you plugin WP Mail SMTP from WPForms .

  • one
    mail() is not something that is out of date - this is a php function and using it can be dangerous and simply not working in certain cases. wp_mail() solves many problems with this. And about the IP - you need to use normal hosting, but not perverted, once again merging the data extra every gugloyanddeksam;) Well, so - plus. - SeVlad

create an email on your hosting, usually hosters provide this opportunity for free.

And write the email sender instead Davydov-Event.

You are banned from the mail because there is no sender.