开始时电子邮件根本没有被发送,但后来我在函数中使用了“-f”参数,然后发送到外部地址(到目前为止测试过的Gmail和Hotmail),但它不适用于域中的地址。只是想知道它是否在代码中,或者它是服务器设置的问题?PHP邮件发送到外部电子邮件地址但不是内部
if ($Valid == 1) {
$_POST = array_map('strip_tags', $_POST);
$_POST = array_map('stripslashes', $_POST);
$To = "[email protected]";
$Subject = "Online Driver Application";
$Body = "All the values of the form that was filled out (removed because there was a lot and it doesn't affect the problem)";
$Headers = 'MIME-Version: 1.0' . "\r\n";
$Headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$Headers .= 'From: Company <[email protected]>' . "\r\n";
$Headers .= 'Reply-To: [email protected]' . "\r\n";
$Headers .= 'X-Mailer: PHP/' . phpversion();
mail($To, $Subject, $Body, $Headers, [email protected]);
echo '<div class="success">Thank You! Your form has been successfully submitted.</div>';
} else {
if ($ErrorMsg != '') {
echo '<div class="error">'.$ErrorMsg.'</div>';
}
同样,除非邮件功能中有[email protected],否则电子邮件根本不会被发送出去。
谢谢。
也许服务器设置问题,如果服务器有类似的Plesk或安装的cPanel,但MX记录指向其他地方(不同地址),服务器可能会看到电子邮件为“内部”并跳过连接,并将邮件传递给自己。 –
他们使用Cpanel。任何想法,我需要去看mx记录? – ETx13