D
D
Deni Naka2018-07-19 20:06:12
PHP
Deni Naka, 2018-07-19 20:06:12

Empty emails when trying to send php mail(). how to fix?

I made a request form on my website

<form action="/mail.php" method="POST" class="contact-form" enctype="multipart/form-data">
                                                            <div class="row">
                                                                <div class="form-group col-md-6 col-lg-6 col-xl-6">
                                                                  <input type="text" id="contact_name" name="name" class="form-control" placeholder="Ваше имя"  required/>
                                                                </div>
                                                                <div class="form-group col-md-6 col-lg-6 col-xl-6 tm-col-email">
                                                                  <input type="email" id="contact_email" name="email" class="form-control" placeholder="E-mail"  required/>
                                                                </div>
                                                            </div>                                                        
                                                            <div class="form-group">
                                                              <textarea id="contact_message" name="message" class="form-control" rows="9" placeholder="Сообщение" required></textarea>
                                                            </div>
                                                            <button type="submit" class="btn btn-primary tm-btn-submit">Отправить</button>
                                                        </form>

and attached PHP handler
<?php
$headers = 'From: Mister-Apple\r\n ';
    'Reply-To: Роман\r\n ';
$theme = 'Заказ';
$letter = 'Данные сообщения:\r\n';
$letter .='Имя:'.$_POST['name'].'\r\n';
$letter .='Почта:'.$_POST['email'].'\r\n';
$letter .='Сообщение:'.$_POST['message'].'\r\n';
mail('[email protected]', $theme , $letter );
?>

but the mail in the spam department receives letters with the heading "New application from the site "Site name"" and with the content "The user wants to contact you with the mail:" (direct quote)
with an error in the word "wants", I did not write this form , but the main thing is that it is empty
itself has never worked with php
5b50c4fbb6218492928437.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deni Naka, 2018-07-20
@Deni_Naka

I found the answer myself

R
Rsa97, 2018-07-19
@Rsa97

Judging by the fact that the phrases you quoted are not in the code or in the form, it is not your php script that works, but some other one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question