我在html页面上有一个联系表格。表单数据被发送到PHP页面,该页面将信息发送到电子邮件地址。它适用于地址* @ gmail,* @ hotmail.com,但需要接收它的人有他们的website.com地址的Outlook设置,它不起作用。我需要在哪里设置其他设置吗?
这是PHP代码:
<?php
$EmailFrom = "myname@website.com";
$EmailTo = "receiver@website.com";
$Subject = "Website Contact Form";
$Name = Trim(stripslashes($_POST['name']));
$Location = Trim(stripslashes($_POST['location']));
$Phone = Trim(stripslashes($_POST['phone']));
$Email = Trim(stripslashes($_POST['email']));
$Comments = Trim(stripslashes($_POST['comments']));
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Location: ";
$Body .= $Location;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
?>
答案 0 :(得分:1)
这个问题出现了很多。
很有可能将邮件客户端(在本例中为outlook)配置为过滤缺少正确标头的邮件。这可能是在客户端点或在smtp时的服务器连接。该问题的主要内容是基本的php mail()
核心功能几乎普遍不信任,因为它可能被垃圾邮件发送者滥用。
您应该尝试使用PHPMailer这样的库来帮助指导您正确设置回复和其他标题。