The mail goes to the spam.



  • Hey, everybody, I've got all the messages in the spam and I don't know what to do. I write php and use mail. Here. https://gist.github.com/Lisss13/d51622d0c68c1b724c4fb055cb9497f1

    $to = 'prob@gmail.com'; 
    $subject = 'Заказ'; 
    if($_POST['message'] == "" || $_POST['message'] == NULL) {
        $_POST['message'] = "Их нет";
    }
    $message = "
            <html>
                <head>
                    <title> {$subject} </title>
                </head>
                <body>
                    <p>Имя: {$_POST['name']} </p>
                    <p>Телефон: {$_POST['phone']} </p>
                    <p>Товар: {$_POST['type']}</p>
                    <p><strong>Пожелания:</strong><br/>{$_POST['message']}</p>
                </body>
            </html>"; 
    $headers  = "Content-type: text/html; charset=utf-8 \r\n"; 
    $headers .= "From: <shop@vector.ru>";
    mail($to, $subject, $message, $headers ); 
    

    вот то, что приходит на почту

    This is what comes to the post office, and it's like all the rules.



  • Judging by the code, you're away from the vector's domain.ru On the DNS, your SPF is only allowed to ship off yandex servers.

    SPF records are published in DNS as TXT records.

    The TXT records found for your domain are: v=spf1 redirect=_spf.yandex.net

    We need to:

    • or build a post office to be sent through Yandex. https://github.com/PHPMailer/PHPMailer

      $mail = new PHPMailer;
      

      //$mail->SMTPDebug = 3; // Enable verbose debug output

      $mail->isSMTP(); // Set mailer to use SMTP
      $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
      $mail->SMTPAuth = true; // Enable SMTP authentication
      $mail->Username = 'user@example.com'; // SMTP username
      $mail->Password = 'secret'; // SMTP password
      $mail->SMTPSecure = 'tls'; // Enable TLS encryption, ssl also accepted
      $mail->Port = 587; // TCP port to connect to

    • Either check that the host from which the list is sent to SPF, and sends it to form the right headings.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2