1

Help configure the sending of mail on the SMS Joomla

There is a Landing for the Joomla, there are 3 forms in the content of the material, I'm trying to send it via Ajax to my PHP file, but in the inverter it says that the file is not found, wherever it was lying, there is no access to it, indicate whether the path is relative or absolute

Looked here the option that blocking access can check the _JEHES constants, but it only shows the file and the error but does not execute

$("#previewForm").submit(function(e) {
                e.preventDefault();
                var form = $("#previewForm");
                var error = false;
                if (!error) {
                    var data = form.serialize();
                    $.ajax({
                        type: 'POST',
                        url: '/feedback.php',
                        dataType: 'json',
                        data: data,
                        success: function(data) {
                            if (data['error']) {
                                alert(data['error']);
                            } else {
                                $('#thanks').modal("show");
                                var form1_input1 = form.find("input");
                                form1_input1.value = "";
                            }
                        },
                        error: function(xhr, ajaxOptions, thrownError) {
                            alert(xhr.status);
                            alert(thrownError);
                        }
                    });
                }
                return false;
            });

<?php
header('charset=utf-8');
$admin_email = '@mail';
$from_email = '@mail';
$project_name = '';
$headers = "MIME-Version: 1.0" . PHP_EOL .
    "Content-Type: text/html; charset=utf-8" . PHP_EOL .
    'From: '.adopt($project_name).' <'.adopt($from_email).'>' . PHP_EOL .
    'Reply-To: '.$admin_email.'' . PHP_EOL;
function adopt($text) {
    return '=?UTF-8?B?'.Base64_encode($text).'?=';
}
if($_POST['act'] === 'preview'){
    $form_subject = "Заявка на консультацию с сайта '".$project_name."'";
    $message = "<tr style='background-color: #f8f8f8;'>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>Форма:</b></td>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'>КУПИТЕ СТОЛЕШНИЦУ ИЗ АГЛОМЕРАТА МОЙКА ИЗ НЕРЖАВЕЮЩЕЙ СТАЛИ -
В ПОДАРОК!</td>
        </tr>";
    $message .= "<tr style='background-color: #f8f8f8;'>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>Имя</b></td>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'>".$_POST['name']."</td>
        </tr>";
    $message .= "<tr style='background-color: #f8f8f8;'>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'><b>Телефон</b></td>
            <td style='padding: 10px; border: #e9e9e9 1px solid;'>".$_POST['phone']."</td>
        </tr>";
    $message = "<table style='width: 100%;'>$message</table>";
    if($_POST['phone'] !== ""){
        if(mail($admin_email, adopt($form_subject), $message, $headers)){
            $answer = ['ok' => 1, 'infos' => '1',];
            echo json_encode($answer);
        } else {
            $answer = ['ok' => 0, 'error' => 1];
            echo json_encode($answer);
        }
    } else {
        $answer = ['ok' => 0, 'error' => [
            'phone' => 'Вы не ввели телефон!']];
        echo json_encode($answer);
    }
}

It always gives a 404 error and I can not send the form in any way, and plugins do not want to use it, since I can not use the 3 times form on the material page

rAP inc.
  • 11
  • 3

0 Answers0