Answer the question
In order to leave comments, you need to log in
How to send a feedback form by mail?
How to write all this or transfer it to Laravel 8 ??
I would be very grateful to anyone who can help solve the issue..
PHP
<?php
if (isset ($_POST['contactFF'])) {
$to = "[email protected]";
$from = $_POST['contactFF'];
$e_mail = "[email protected]";
$subject = "Образовательный Центр";
$message = "Email: ".$from. "\nID: " .$_POST['idnumber']. "\nФИО: ".$_POST['fio']. "\nТелефон: ".$_POST['phone']. "\nРазмер помещения: " .$_POST['sizePlace']. "\nНазвание ОЦ: " .$_POST['nameoz']. "\nАдрес ОЦ с индексом: " .$_POST['adres'];
$boundary = md5(date('r', time()));
$filesize = '';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: " . $e_mail . "\r\n";
$headers .= "Reply-To: " . $from . "\r\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\r\n";
$message="
Content-Type: multipart/mixed; boundary=\"$boundary\"
--$boundary
Content-Type: text/plain; charset=\"utf-8\"
Content-Transfer-Encoding: 7bit
$message";
for($i=0;$i<count($_FILES['fileFF']['name']);$i++) {
if(is_uploaded_file($_FILES['fileFF']['tmp_name'][$i])) {
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['fileFF']['tmp_name'][$i])));
$filename = $_FILES['fileFF']['name'][$i];
$filetype = $_FILES['fileFF']['type'][$i];
$filesize += $_FILES['fileFF']['size'][$i];
$message.="
--$boundary
Content-Type: \"$filetype\"; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=\"$filename\"
$attachment";
}
}
$message.="
--$boundary--";
if ($filesize < 100000000) { // проверка на общий размер всех файлов. Многие почтовые сервисы не принимают вложения больше 10 МБ
mail($to, $subject, $message, $headers);
echo $_POST['fio'].', Окончательное решение об открытии центра будет принято Компанией на основании анализа экономической целесообразности.';
} else {
echo 'Извините, письмо не отправлено. Размер всех файлов превышает 100 МБ.';
}
}
?>
Answer the question
In order to leave comments, you need to log in
https://github.com/avsbru/laravel-docs-8.x-ru/blob...
UPD
we make a route to receive data, in the handler, we receive a request , we perform validation , we extract files from the request and send them by mail
Total :
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question