我有这个表格工作正常,但在雅虎有时它会发送电子邮件到SPAM文件夹。任何的想法?感谢。
这是html:
<form name="frm" id="frm" method="POST" action="contact.php">
<label>Name</label>
<input type="text" name="name" id="name" class="validate[required,custom[alphaspace]] for_obj" />
<label>Company Name</label>
<input type="text" name="company" id="company" />
<label>Email</label>
<input type="text" name="email" id="email" class="validate[required,custom[email]] for_obj" />
<label>Phone</label>
<input type="text" name="phone" id="phone" />
<label>Country Name</label>
<input type="text" name="country" id="country" class="validate[required,custom[alphaspace]] for_obj" />
<label>Interested</label>
<select type="text" name="interested" id="interested" class="validate[required,custom[alphaspace]] for_obj">
<option value="select">--Select--</option>
<option value="Information">Information</option>
<option value="Product">Product</option>
<option value="Career">Career</option>
<option value="Others">Others</option>
</select>
<label for="message">Message</label>
<textarea name="message" id="message" class="validate[required] for_obj" rows="8" cols="10"></textarea>
<input type="submit" value="Send" class="butt custom_font" />
<input type="reset" value="reset" class="butt custom_font" />
</form>
这是php:
<?php
$name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$country = $_POST['country'];
$interested = $_POST['interested'];
$message = $_POST['message'];
$formcontent="From: $name \n Company Name: $company \nPhone: $phone \n Country Name: $country \nInterested: $interested \n Message: $message";
if ($interested == 'Information') {
$to = 'information@mysite.com';
}
else if ($interested == 'Product') {
$to = 'product@mysite.com';
}
else if ($interested == 'Career') {
$to = 'career@mysite.com';
}
else { //other options
$to = 'others@mysite.com';
}
$subject = "Enquiry from Website";
$mailheader = "From: $email \r\n";
mail($to, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You! <br /> We will get in touch with you as soon as possible.";
?>
答案 0 :(得分:0)
我认为你可以解决这个问题,就像我使用PHPMailer Library一样,雅虎可能会将你的电子邮件发送到SPAM文件夹,因为他们需要验证,PHPMailer允许你通过SMTP设置对你的表单进行,这是一个很棒的图书馆试试吧!很好的编码。