開始時電子郵件根本沒有被髮送,但後來我在函數中使用了「-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