There is an application form from the landing page, and the letters come in one thread. The next day begins, the first application arrives in a new letter, all the others again begin to fall into the same chain. Letters come to the gmail box. I send mail php, mail created on a hosting. According to the instructions from the hosting.

Each form contains such identifiers.

<input type="hidden" name="project_name" value="Заявка с лендинга"> <input type="hidden" name="admin_email" value="мойимейл@gmail.com"> <input type="hidden" name="form_subject" value="Форма главный экран"> 

Here is the php sending itself

 <?php $method = $_SERVER['REQUEST_METHOD']; //Script Foreach $c = true; if ( $method === 'POST' ) { $project_name = trim($_POST["project_name"]); $admin_email = trim($_POST["admin_email"]); $form_subject = trim($_POST["form_subject"]); foreach ( $_POST as $key => $value ) { if ( $value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject" ) { $message .= " " . ( ($c = !$c) ? '<tr>':'<tr style="background-color: #f8f8f8;">' ) . " <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>$key</b></td> <td style='padding: 10px; border: #e9e9e9 1px solid;'>$value</td> </tr> "; } } } else if ( $method === 'GET' ) { $project_name = trim($_GET["project_name"]); $admin_email = trim($_GET["admin_email"]); $form_subject = trim($_GET["form_subject"]); foreach ( $_GET as $key => $value ) { if ( $value != "" && $key != "project_name" && $key != "admin_email" && $key != "form_subject" ) { $message .= " " . ( ($c = !$c) ? '<tr>':'<tr style="background-color: #f8f8f8;">' ) . " <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>$key</b></td> <td style='padding: 10px; border: #e9e9e9 1px solid;'>$value</td> </tr> "; } } } $message = "<table style='width: 100%;'>$message</table>"; mail($admin_email, $form_subject, $message, "From: $project_name <opt@grade-coffee.com>" . "\r\n" . "Reply-To: opt@grade-coffee.com" . "\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\n" . "Content-type: text/html; charset=\"utf-8\""); 
  • In one chain, this is when you open a letter in a table, and under it are a bunch of letters, just like on Yandex? All emails coming to the same address? It seems to be the same. - DaemonHK
  • Yes, a bunch of letters in one. Need each letter in a separate message. Before that, when sent from my mail (and not from the hosting one) to my own. Everything came in separate letters, but often gets - Max

1 answer 1

And what do you want to achieve? Google sorts the threads by subject:

Message Chains: (determines whether emails related by one topic will be grouped)

You have one theme in hidden

 <input type="hidden" name="form_subject" value="Форма главный экран"> 

Accordingly, all letters will be collected. If you want to share, you can add a date and time to the topic or a unique code,

 uniqid(); 

then each letter will be individual, or disable the chain of letters in Google.

  • and how to add uniqid () correctly; and where? please tell - Max
  • for example, here> $ form_subject = trim ($ _ POST ["form_subject"]). "No." .uniqid (); - ALexander
  • thank you, it works. A random number with letters and numbers is added to the subject of the letter. It would be cool to make an ordinal report happen. Type number 1, trail. application number 2 and so on. Is it possible to somehow implement this?) - Max
  • Yes, this can also be done - you will need to make your letter count - for example, as described here coderhs.com/archive/easy_count_php - just count the number of completed forms - ALexander