简体   繁体   English

由于主机上的垃圾邮件过滤,某些联系表单未发送电子邮件

[英]Some contact form emails not being sent due to spam filtering on host

I need my contact form on my website to be adjusted. 我需要调整我网站上的联系表格。 It's a PHP/Ajax Contact Form. 这是一个PHP / Ajax联系表。

Currently i have a problem - When a client fills out my contact form NAME - EMAIL - SUBJECT - MESSAGE there is an issue with my DREAMHOST Server due to their new anti spam policy and i dont receive some messages - If their email is @hotmail.com that's fine. 目前我有一个问题 - 当客户填写我的联系表格NAME - EMAIL - SUBJECT - MESSAGE我的DREAMHOST服务器存在问题,因为他们的新反垃圾邮件政策并且我没有收到一些消息 - 如果他们的电子邮件是@hotmail。那没关系。 But if their email is @gmail.com i dont get the message etc. 但如果他们的电子邮件是@ gmail.com我不会收到消息等。

DREAMHOST TELLS ME: DREAMHOST告诉我:

Thanks for contacting Tech Support I checked the logs for the form on your site and did see that the emails are being bounced by the server due to recently implemented anti spam policies which won't allow email sent from the server using non-Dreamhost outgoing servers or "send from" email addresses. 感谢您联系技术支持我检查了您网站上的表单日志,并确实看到服务器因最近实施的反垃圾邮件策略而退回电子邮件,这些策略不允许使用非Dreamhost传出服务器从服务器发送电子邮件或“发送”电子邮件地址。 You can read more details on this policy here: 您可以在此处阅读有关此政策的更多详情:

http://wiki.dreamhost.com/Sender_Domain_Policy_and_Spoofing http://wiki.dreamhost.com/Sender_Domain_Policy_and_Spoofing

Your mail form uses the visitor's email address as the 'From' address which in most cases is not a Dreamhost hosted email address. 您的邮件表单使用访问者的电子邮件地址作为“发件人”地址,在大多数情况下,该地址不是Dreamhost托管的电子邮件地址。 Due to the spam policy above, the server will block mail being sent off the server if the email addresses are not using Dreamhost mail servers. 由于上面的垃圾邮件策略,如果电子邮件地址未使用Dreamhost邮件服务器,服务器将阻止从服务器发送的邮件。 So what you will need to do is either set the mail form to use your Dreamhost hosted address as the 'From' address. 因此,您需要做的是将邮件表单设置为使用Dreamhost托管地址作为“发件人”地址。

Or you will need to find another mail form that will allow you to set a fixed email address as the 'From' address. 或者您需要找到另一个邮件表单,允许您将固定的电子邮件地址设置为“发件人”地址。 This way you can set a Dreamhost hosted email address in the form as the 'From' address. 这样,您可以在表单中将Dreamhost托管的电子邮件地址设置为“发件人”地址。

THE CODE AS FOLLOWS: 该守则如下:

<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/
*/

include dirname(dirname(__FILE__)).'/config.php';

error_reporting (E_ALL ^ E_NOTICE);

$post = (!empty($_POST)) ? true : false;

if($post)
{
include 'functions.php';

$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);


$error = '';

// Check name

if(!$name)
{
$error .= 'Please enter your name.<br />';
}

// Check email

if(!$email)
{
$error .= 'Please enter an e-mail address.<br />';
}

if($email && !ValidateEmail($email))
{
$error .= 'Please enter a valid e-mail address.<br />';
}

// Check message (length)

if(!$message || strlen($message) < 15)
{
$error .= "Please enter your message. It should have at least 15 characters.<br />";
}


if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
     "From: ".$name." <".$email.">\r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());


if($mail)
{
echo 'OK';
}

}
else
{
echo '<div class="notification_error">'.$error.'</div>';
}

}
?>

All i need to know is what i need to do to the code so i can receive all submissions of my contact form. 我需要知道的是我需要对代码做什么,所以我可以收到我的联系表单的所有提交。 I would really be grateful if someone could help. 如果有人能提供帮助我真的很感激。

Replace the following: 替换以下内容:

mail = mail(WEBMASTER_EMAIL, $subject, $message,
 "From: ".$name." <".$email.">\r\n"
."Reply-To: ".$email."\r\n"

with just: 只是:

$mail = mail(WEBMASTER_EMAIL, $subject, $message,"X-Mailer: PHP/" . phpversion());

and add the user's email address to your message if you need to. 并根据需要将用户的电子邮件地址添加到您的邮件中。 What you are doing right now is called spoofing and even when well-intentioned, you are essentially committing fraud. 你现在正在做的事情被称为欺骗 ,即使是善意的,你实际上也是在欺诈。 It would be the equivalent of someone calling you to show interest in your product and you taking down their physical address and putting that in the upper-left corner of an envelope and then sending yourself a letter saying that the caller is interested. 这相当于有人打电话给你对你的产品表现出兴趣,你取下他们的实际地址,把它放在信封的左上角,然后给自己发一封信,说打电话的人有兴趣。 In addition to this just being a fairly-odd way of doing things, it also suggests an electronic paper trail that suggests the user actually emailed you, which they did not. 除了这只是一种相当奇怪的做事方式之外,它还建议使用电子纸质记录,建议用户实际上通过电子邮件发送给您,而他们却没有。 I personally would be uncomfortable finding out my email address was used in this way after filling out an online form. 在填写在线表格后,我个人会不自在地发现我的电子邮件地址是以这种方式使用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM