问题
我有一个简单的电子邮件脚本,可将发布的表单数据发送到电子邮件地址。但是我不确定为什么它不起作用E.I发送数据。
我怀疑的可能原因
我的电子邮件脚本
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$tel = $_POST['tel'];
$enquiry = $_POST['enquiry'];
$message = $_POST['message'];
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y');
$time = date('H:i:s');
$headers = "From: Info@Columbus.com" . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$emailbody = "<p>You have recieved a new message from the Contact Us form on your website.</p>
<p><strong><u>Contact Details</u></strong></p>
<p><strong>Name: </strong> {$name} </p>
<p><strong>Enquiry: </strong> {$enquiry} </p>
<p><strong>Email Address: </strong> {$email} </p>
<p><strong>Telephone: </strong> {$tel} </p>
<p><strong>Message: </strong> {$message} </p>
<br/>
<p>This message was sent from the IP Address: {$ipaddress} on {$date} at {$time}</p>";
@mail("Hardcoreraver_2002@hotmail.com","New Enquiry",$emailbody,$headers);
?>
我的表单使用Ajax PreventDefault()和BootStrap模式进行确认
<div id="stylized" class="form2" >
<form id="form2" method="POST" action="contactEmailScript.php" style="width: 500px; height: 400px; padding-left: 20px; padding-right: 70px; float: left;">
<label>Enquiry<span class="small">Type of Enquiry</span></label>
<select id="enquiry" name="enquiry" required autofocus style="float:left" >
<option value=""></option>
<option value="General">General</option>
<option value="Change of Details">Change Of Details</option>
<option value="Complaint">Complaint</option>
<option value="Misc">Misc</option>
<option value="Other">Other</option>
</select>
<label>Telephone<span class="small">Min. size 6 chars</span></label>
<input type="tel" id="tel" name="tel" placeholder="Tel. Number" style="float:left; width:195px;"/>
<label>Email<span class="small">Add a valid Address</span></label>
<input type="text" name="email" id="email" placeholder="johndoe@example.com" style="width:195px;" />
<label style="padding-right:10px">Message<span class="required">*</span><span class="small">Additional Info</span></label>
<textarea style="width: 200px;" id="message" name="message" placeholder="Your message must be greater than 20 characters" required data-minlength="20"></textarea>
<button type="submit">Contact Us</button>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.5.1.min.js"%3E%3C/script%3E'))</script>
<script src="less-1.7.0.min.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="bootstrap.min.js"></script>
<script src="bootbox.min.js"></script>
<script>
console.log ('before ajax');
$('#form2').submit(function (e) {
e.preventDefault();
bootbox.confirm("Are you sure?", function (result) {
if (result) {
console.log("user confirmed");
$.ajax({
type: 'POST',
url: 'contactEmailScript.php',
data: $("#form2").serialize(),
error: function () {
console.log('Ajax Error');}, //Debug Line
success: function (response) {
console.log('Ajax Success'); //Debug Line
$('.afterConfirmContact').css({
display: "inline",
height: 680,
width: 940
});
$('.beforeConfirmContact').css({
display: "none"
});
$('#form2').css({
display: "none"
});
console.log("After CSS change");
}
});
}else{}
});
});
</script>
任何想法都会很棒,我非常确信代码写得正确。
NB:奇怪的是,我在测试时设法发送了几封电子邮件,但只有每半个小时左右?所以这导致我认为isp或托管公司并将电子邮件地址或我的IP列入黑名单?这可能吗?
答案 0 :(得分:0)
原来是isp或电子邮件提供商(hotmail)限制每30分钟发送/接收一封电子邮件的数量。更改为我自己的付费电子邮件地址,所有问题都已解决!感谢所有的贡献,并试图帮助!