Answer the question
In order to leave comments, you need to log in
How to correctly configure the sending of mail messages from the server?
On two different free servers I use the same php code to send data from the contact form:
<meta http-equiv='refresh' content='3; url=http://xxx.com/'>
<meta charset="utf-8">
<?php
if (isset($_POST['name'])) {$name = $_POST['name']; if ($name == '') {unset($name);}}
if (isset($_POST['phone'])) {$phone = $_POST['phone']; if ($phone == '') {unset($phone);}}
if (isset($name) && isset($phone)){
$address = "[email protected]";
$mes = "Имя: $name \n Телефон: $phone";
$send = mail ($address,$mes,"Content-type:text/plain; charset = UTF-8\r\nFrom:$name");
if ($send == 'true')
{echo "Сообщение отправлено, через 3 секунд Вы будете направлены на главную страницу, где сможете продолжить чтение <a href='http://xxx.com/'>xxx</a>";}
else {echo "Ошибка, сообщение не отправлено!";}
}
else
{
echo "Вы заполнили не все поля, необходимо вернуться назад!";
}
?>
Answer the question
In order to leave comments, you need to log in
if postfix is not configured on the server, nothing will come. Or it will go to spam as a letter sent from an untrusted server. If you want reliability, look for an SMTP provider.
And yes, use ready-made solutions, ala swiftmailer. Always use something ready-made for mail. There will be fewer problems.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question