帮助配置在SMS Joomla上发送邮件
Joomla有一个Landing,材料的内容有三种形式,我试图通过Ajax将它发送到我的PHP文件,但在逆变器中它说找不到文件,无论它在哪里,都无法访问它,指明路径是相对的还是绝对的
在这里查看阻止访问可以检查_JEHES常量的选项,但它只显示文件和错误但不执行
$("#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);
}
}
它总是出现404错误而且我无法以任何方式发送表单,并且插件不想使用它,因为我不能在材料页面上使用3次表单