繁体   English   中英

在DreamHost上欺骗mail.php

[英]spoofing mail.php on DreamHost

我是php的新手,我的send-mail.php文件遇到了麻烦,该文件托管在dreamhost上。

// site owner
$to = trim( $_POST['to'] );
$subject = trim( $_POST['subject'] );

// contact form fields
$name = trim( $_POST['name'] );
$email = trim( $_POST['email'] );
$message = trim( $_POST['message'] );


// check for error
$error = false;

if ( $name === "" )
{
    $error = true;
}
elseif ( $email === "" )
{
    $error = true;
}
elseif ( $message === "" )
{
    $error = true;
}
// end check for error

// no error send mail
if ( !$error )
{

    $body = "Name: $name \n\nEmail: $email \n\nMessage: $message";

    $headers = 'From: ' . $name . ' <' . $email . '> ' . "\r\n" . 'Reply-To: ' . $email;

    mail( $to, $subject, $body, $headers );

    echo 'success';

}
else
{
    echo 'error';
}
// end no error send mail
?>

因此,由于它们具有反垃圾邮件过滤器,因此在DreamHost上将不起作用。

他们说了这个

The FROM address needs to belong to the domain (ie @mydomain.ie)
Once that is changed in the form settings, mail should be able to send correctly. This change was done to help prevent spam that was coming from the server:

http://dhurl.org/20b

If you would still like to keep the user inputted e-mail address, you would need to set it to be the REPLY-TO address instead of the FROM address.  

我对php完全陌生,每次我尝试编辑代码时,都参考DreamHost Wiki,我最终还是搞砸了!

如果有人可以帮助我,我将不胜感激。

由于主机创建限制。

只需在您的电子邮件字段中使用来自您的域的电子邮件(例如,noreply @ yourdomain.com),然后按预期使用“回复”即可:

 $name . ' <noreply@yourdomain.com> ' . "\r\n" . 'Reply-To: ' . $email

您的电子邮件现在应该已发送。

FROM地址必须属于该域

差不多就是这个了。 如果他们做得对,就没有办法避免这种情况。

如果您希望将任何响应发送给其他人,则可以设置Reply-to标头。

暂无
暂无

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

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