我的联系表格有问题,提交表格后我没有收到任何邮件。 当我使用其他托管平台它工作得很好,所以它似乎是我当前的提供商的问题,我已经联系他们但他们只建议使用PhPMailer但我不明白如何设置它。有没有办法改变我的代码才能正常工作?
mail.php文件:
data['tf_idf_norm'] = data['tf_idf'].apply(lambda x: {key:value*(1.0/sum(x.values())) for key, value in x.iteritems()})
mail.js文件:
<?php
$frm_name = "John Doe"; //your name
$recepient = "xyz@gmail.com"; //your e-mail
$sitename = "John Doe Site"; //your site name
$subject = "New contact from \"$sitename\""; //subject template
$name = trim($_POST["visitor_name"]);
$email = trim($_POST["visitor_email"]);
$msg = trim($_POST["visitor_msg"]);
$message = "
-------------------<br><br>
Visitor name: $name <br>
Visitor email: $email <br><br>
$msg
<br><br>-------------------
";
mail($recepient, $subject, $message, "From: $name <$recepient>" . "\r\n" . "Reply-To: $recepient" . "\r\n" . "X-Mailer: PHP/" . phpversion() . "\r\n" . "Content-type: text/html; charset=\"utf-8\"");
?>
Html代码:
// form handling
$('.form-contact').submit(function(e) {
e.preventDefault();
// validity polyfill for Safari browser
if (!e.target.checkValidity()) {
alert('Please fill out the required fields.'); // error message
} else {
$.ajax({
type: 'POST',
url: 'mail.php',
data: $(this).serialize()
}).done(function() {
setTimeout(function() {
alert('Thanks for your message! I will reply you as soon as possible.');
}, 1500);
}).fail(function() {
setTimeout(function() {
alert('Something went wrong :( Please contact me directly to my email.');
}, 1500);
});
}
});