【发布时间】:2016-05-01 15:37:18
【问题描述】:
我建立了一个小型网站,允许人们通过输入他们自己的电子邮件和他们的代表电子邮件来向他们的代表发送预先编写的电子邮件。 它是使用 sendmail 设置的,可用于发送到 gmail、我拥有的个人电子邮件和各种其他域。但是,它无法发送到我需要发送到的一个域。 我得到以下错误
<www-data@localhost.localdomain>: Sender address rejected: Domain not found
我一直在看天知道有多少东西,但我似乎无法弄清楚它是否适用于其他所有东西。
希望有人能解释一下。干杯!
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_recipient = $_POST['cf_recipient'];
$subject = 'Message Regarding Cuts in the Mental Health Budget';
$body_message = 'hello';
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$headers .= 'Return-Path: '.$field_email;
$mail_status = mail($field_recipient, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We hope this will get the TDs in gear.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, make sure all boxes have been filled and try again.');
window.location = 'index.html';
</script>
<?php
}
?>
【问题讨论】:
-
您提供的邮寄地址是什么?
-
您能发布您的发件人代码吗?
-
@MatthewCliatt 在代码中添加,谢谢。