为什么我会收到 SPF Softfail?

为什么我会收到 SPF Softfail?

我在 LAMP 服务器上安装了带有 postfix 的 SPF。但出于某种原因,我收到此错误

Received-SPF: softfail (mta1070.mail.re4.yahoo.com: domain of transitioning [email protected] does not designate 1.1.1.1 as permitted sender)

我有两个问题:

1)我该如何解决这个错误

2)我一直在查看我的配置文件,试图改变[电子邮件保护][电子邮件保护]因为 anotherurl.com 有正确的 SPF TXT 记录。我该去哪里更改它?我尝试在 /etc/postfix/main.cf 下编辑 myhostname,但没有任何反应。

答案1

由于您是通过 PHP 发送的,因此您需要正确设置标头并使用邮件函数的最后一个参数。类似下面的代码即可

<?php
$fromemail='[email protected]';
$to="[email protected]";
$subject="this is an email";
$headers = 'MIME-Version: 1.0' . "\r\n".'Content-type: text/html; charset=UTF-8'."\r\n".'From: '.$fromemail."\r\n" .
$headers .= "Reply-To: ".$fromemail."\r\n";
$headers .= "Return-Path: ".$fromemail."\r\n";
$extra='-r '.$fromemail;
mail($to,$subject,$message,$headers,$extra);

相关内容