简体   繁体   English

在DreamHost上欺骗mail.php

[英]spoofing mail.php on DreamHost

I'm very new to php and am having trouble with my send-mail.php file which is being hosted 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
?>

So this won't work on DreamHost because of their anti-spam filters. 因此,由于它们具有反垃圾邮件过滤器,因此在DreamHost上将不起作用。

They said this 他们说了这个

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.  

I'm totally new to php and every time I try to edit the code, with reference to the DreamHost wiki, I end up breaking the thing! 我对php完全陌生,每次我尝试编辑代码时,都参考DreamHost Wiki,我最终还是搞砸了!

I would really appreciate it if someone could help me out. 如果有人可以帮助我,我将不胜感激。

Its due to the host creating restrictions. 由于主机创建限制。

Simply use an email from your domain (eg noreply@yourdomain.com) for the email field, and just use the Reply-To as intended: 只需在您的电子邮件字段中使用来自您的域的电子邮件(例如,noreply @ yourdomain.com),然后按预期使用“回复”即可:

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

Your emails should now be sent. 您的电子邮件现在应该已发送。

The FROM address needs to belong to the domain FROM地址必须属于该域

that's pretty much what it is about. 差不多就是这个了。 If they did their job right, there is no way to circumvent this. 如果他们做得对,就没有办法避免这种情况。

You can set the Reply-to header if you want any responses to be sent to someone else. 如果您希望将任何响应发送给其他人,则可以设置Reply-to标头。

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

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